2 Copyright (C) 2005, 2006
3 Free Software Foundation, Inc.
4 This is part of the GNU Fortran manual.
5 For copying conditions, see the file gfortran.texi.
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 use.
20 (3) The specific names are included in the function index and in a
21 table at the end of the node (See ABS entry).
22 (4) Try to maintain the same style for each entry.
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
53 * @code{ABORT}: ABORT, Abort the program
54 * @code{ABS}: ABS, Absolute value
55 * @code{ACCESS}: ACCESS, Checks file access method
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
255 @section Introduction to intrinsic procedures
257 GNU Fortran provides a rich set of intrinsic procedures that includes all
258 the intrinsic procedures required by the Fortran 95 standard, a set of
259 intrinsic procedures for backwards compatibility with Gnu Fortran 77
260 (i.e., @command{g77}), and a small selection of intrinsic procedures
261 from the Fortran 2003 standard. Any description here, which conflicts with a
262 description in either the Fortran 95 standard or the Fortran 2003 standard,
263 is unintentional and the standard(s) should be considered authoritative.
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 intrinsics procedures take one or more optional arguments.
279 This document follows the convention used in the Fortran 95 standard,
280 and denotes such arguments by square brackets.
282 GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
283 which can be used to restrict the set of intrinsic procedures to a
284 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
285 option, and so all intrinsic procedures described here are accepted. There
286 is one caveat. For a select group of intrinsic procedures, @command{g77}
287 implemented both a function and a subroutine. Both classes
288 have been implemented in @command{gfortran} for backwards compatibility
289 with @command{g77}. It is noted here that these functions and subroutines
290 cannot be intermixed in a given subprogram. In the descriptions that follow,
291 the applicable option(s) is noted.
296 @section @code{ABORT} --- Abort the program
297 @findex @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}
334 @section @code{ABS} --- Absolute value
335 @findex @code{ABS} intrinsic
336 @findex @code{CABS} intrinsic
337 @findex @code{DABS} intrinsic
338 @findex @code{IABS} intrinsic
339 @findex @code{ZABS} intrinsic
340 @findex @code{CDABS} intrinsic
341 @cindex absolute value
344 @item @emph{Description}:
345 @code{ABS(X)} computes the absolute value of @code{X}.
347 @item @emph{Standard}:
348 F77 and later, has overloads that are GNU extensions
356 @item @emph{Arguments}:
357 @multitable @columnfractions .15 .80
358 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
359 @code{REAL(*)}, or @code{COMPLEX(*)}.
362 @item @emph{Return value}:
363 The return value is of the same type and
364 kind as the argument except the return value is @code{REAL(*)} for a
365 @code{COMPLEX(*)} argument.
367 @item @emph{Example}:
372 complex :: z = (-1.e0,0.e0)
379 @item @emph{Specific names}:
380 @multitable @columnfractions .20 .20 .20 .40
381 @item Name @tab Argument @tab Return type @tab Standard
382 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab F77 and later
383 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
384 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
385 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
386 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
392 @section @code{ACCESS} --- Checks file access method
393 @findex @code{ACCESS}
394 @cindex file system functions
396 Not yet implemented in GNU Fortran.
399 @item @emph{Description}:
401 @item @emph{Standard}:
406 @item @emph{Arguments}:
407 @item @emph{Return value}:
408 @item @emph{Example}:
409 @item @emph{Specific names}:
410 @item @emph{See also}:
416 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
417 @findex @code{ACHAR} intrinsic
418 @cindex @acronym{ASCII} collating sequence
421 @item @emph{Description}:
422 @code{ACHAR(I)} returns the character located at position @code{I}
423 in the @acronym{ASCII} collating sequence.
425 @item @emph{Standard}:
434 @item @emph{Arguments}:
435 @multitable @columnfractions .15 .80
436 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
439 @item @emph{Return value}:
440 The return value is of type @code{CHARACTER} with a length of one. The
441 kind type parameter is the same as @code{KIND('A')}.
443 @item @emph{Example}:
448 end program test_achar
455 @section @code{ACOS} --- Arccosine function
456 @findex @code{ACOS} intrinsic
457 @findex @code{DACOS} intrinsic
458 @cindex trigonometric functions (inverse)
461 @item @emph{Description}:
462 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
464 @item @emph{Standard}:
473 @item @emph{Arguments}:
474 @multitable @columnfractions .15 .80
475 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
479 @item @emph{Return value}:
480 The return value is of type @code{REAL(*)} and it lies in the
481 range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter
482 is the same as @var{X}.
484 @item @emph{Example}:
487 real(8) :: x = 0.866_8
489 end program test_acos
492 @item @emph{Specific names}:
493 @multitable @columnfractions .20 .20 .20 .40
494 @item Name @tab Argument @tab Return type @tab Standard
495 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
498 @item @emph{See also}:
499 Inverse function: @ref{COS}
505 @section @code{ACOSH} --- Hyperbolic arccosine function
506 @findex @code{ACOSH} intrinsic
507 @cindex hyperbolic arccosine
508 @cindex hyperbolic cosine (inverse)
511 @item @emph{Description}:
512 @code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
514 @item @emph{Standard}:
523 @item @emph{Arguments}:
524 @multitable @columnfractions .15 .80
525 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
526 greater or equal to one.
529 @item @emph{Return value}:
530 The return value is of type @code{REAL(*)} and it lies in the
531 range @math{0 \leq \acosh (x) \leq \infty}.
533 @item @emph{Example}:
536 REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
541 @item @emph{See also}:
542 Inverse function: @ref{COSH}
548 @section @code{ADJUSTL} --- Left adjust a string
549 @findex @code{ADJUSTL} intrinsic
550 @cindex adjust string
553 @item @emph{Description}:
554 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
555 Spaces are inserted at the end of the string as needed.
557 @item @emph{Standard}:
564 @code{STR = ADJUSTL(STR)}
566 @item @emph{Arguments}:
567 @multitable @columnfractions .15 .80
568 @item @var{STR} @tab The type shall be @code{CHARACTER}.
571 @item @emph{Return value}:
572 The return value is of type @code{CHARACTER} where leading spaces
573 are removed and the same number of spaces are inserted on the end
576 @item @emph{Example}:
579 character(len=20) :: str = ' gfortran'
582 end program test_adjustl
589 @section @code{ADJUSTR} --- Right adjust a string
590 @findex @code{ADJUSTR} intrinsic
591 @cindex adjust string
594 @item @emph{Description}:
595 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
596 Spaces are inserted at the start of the string as needed.
598 @item @emph{Standard}:
605 @code{STR = ADJUSTR(STR)}
607 @item @emph{Arguments}:
608 @multitable @columnfractions .15 .80
609 @item @var{STR} @tab The type shall be @code{CHARACTER}.
612 @item @emph{Return value}:
613 The return value is of type @code{CHARACTER} where trailing spaces
614 are removed and the same number of spaces are inserted at the start
617 @item @emph{Example}:
620 character(len=20) :: str = 'gfortran'
623 end program test_adjustr
630 @section @code{AIMAG} --- Imaginary part of complex number
631 @findex @code{AIMAG} intrinsic
632 @findex @code{DIMAG} intrinsic
633 @findex @code{IMAG} intrinsic
634 @findex @code{IMAGPART} intrinsic
635 @cindex Imaginary part
638 @item @emph{Description}:
639 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
640 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
641 for compatibility with @command{g77}, and their use in new code is
642 strongly discouraged.
644 @item @emph{Standard}:
645 F77 and later, has overloads that are GNU extensions
653 @item @emph{Arguments}:
654 @multitable @columnfractions .15 .80
655 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
658 @item @emph{Return value}:
659 The return value is of type real with the
660 kind type parameter of the argument.
662 @item @emph{Example}:
667 z4 = cmplx(1.e0_4, 0.e0_4)
668 z8 = cmplx(0.e0_8, 1.e0_8)
669 print *, aimag(z4), dimag(z8)
670 end program test_aimag
673 @item @emph{Specific names}:
674 @multitable @columnfractions .20 .20 .20 .40
675 @item Name @tab Argument @tab Return type @tab Standard
676 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab GNU extension
677 @item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
678 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
685 @section @code{AINT} --- Truncate to a whole number
686 @findex @code{AINT} intrinsic
687 @findex @code{DINT} intrinsic
691 @item @emph{Description}:
692 @code{AINT(X [, KIND])} truncates its argument to a whole number.
694 @item @emph{Standard}:
702 @code{X = AINT(X, KIND)}
704 @item @emph{Arguments}:
705 @multitable @columnfractions .15 .80
706 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
707 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
708 initialization expression.
711 @item @emph{Return value}:
712 The return value is of type real with the kind type parameter of the
713 argument if the optional @var{KIND} is absent; otherwise, the kind
714 type parameter will be given by @var{KIND}. If the magnitude of
715 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
716 magnitude is equal to or greater than one, then it returns the largest
717 whole number that does not exceed its magnitude. The sign is the same
718 as the sign of @var{X}.
720 @item @emph{Example}:
727 print *, aint(x4), dint(x8)
729 end program test_aint
732 @item @emph{Specific names}:
733 @multitable @columnfractions .20 .20 .20 .40
734 @item Name @tab Argument @tab Return type @tab Standard
735 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
742 @section @code{ALARM} --- Execute a routine after a given delay
743 @findex @code{ALARM} intrinsic
746 @item @emph{Description}:
747 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
748 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
749 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
750 supplied, it will be returned with the number of seconds remaining until
751 any previously scheduled alarm was due to be delivered, or zero if there
752 was no previously scheduled alarm.
754 @item @emph{Standard}:
761 @code{CALL ALARM(SECONDS, HANDLER)}
762 @code{CALL ALARM(SECONDS, HANDLER, STATUS)}
764 @item @emph{Arguments}:
765 @multitable @columnfractions .15 .80
766 @item @var{SECONDS} @tab The type of the argument shall be a scalar
767 @code{INTEGER}. It is @code{INTENT(IN)}.
768 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
769 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
770 @code{INTEGER}. It is @code{INTENT(IN)}.
771 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
772 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
775 @item @emph{Example}:
778 external handler_print
780 call alarm (3, handler_print, i)
783 end program test_alarm
785 This will cause the external routine @var{handler_print} to be called
792 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
793 @findex @code{ALL} intrinsic
797 @item @emph{Description}:
798 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
799 in the array along dimension @var{DIM}.
801 @item @emph{Standard}:
805 transformational function
809 @code{L = ALL(MASK, DIM)}
811 @item @emph{Arguments}:
812 @multitable @columnfractions .15 .80
813 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
814 it shall not be scalar.
815 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
816 with a value that lies between one and the rank of @var{MASK}.
819 @item @emph{Return value}:
820 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
821 the kind type parameter is the same as the kind type parameter of
822 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
823 an array with the rank of @var{MASK} minus 1. The shape is determined from
824 the shape of @var{MASK} where the @var{DIM} dimension is elided.
828 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
829 It also is true if @var{MASK} has zero size; otherwise, it is false.
831 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
832 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
833 is determined by applying @code{ALL} to the array sections.
836 @item @emph{Example}:
840 l = all((/.true., .true., .true./))
845 integer a(2,3), b(2,3)
849 print *, all(a .eq. b, 1)
850 print *, all(a .eq. b, 2)
851 end subroutine section
859 @section @code{ALLOCATED} --- Status of an allocatable entity
860 @findex @code{ALLOCATED} intrinsic
861 @cindex allocation status
864 @item @emph{Description}:
865 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
867 @item @emph{Standard}:
874 @code{L = ALLOCATED(X)}
876 @item @emph{Arguments}:
877 @multitable @columnfractions .15 .80
878 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
881 @item @emph{Return value}:
882 The return value is a scalar @code{LOGICAL} with the default logical
883 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
884 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
886 @item @emph{Example}:
888 program test_allocated
890 real(4), allocatable :: x(:)
891 if (allocated(x) .eqv. .false.) allocate(x(i))
892 end program test_allocated
898 @section @code{AND} --- Bitwise logical AND
899 @findex @code{AND} intrinsic
900 @cindex bit operations
903 @item @emph{Description}:
904 Bitwise logical @code{AND}.
906 This intrinsic routine is provided for backwards compatibility with
907 GNU Fortran 77. For integer arguments, programmers should consider
908 the use of the @ref{IAND} intrinsic defined by the Fortran standard.
910 @item @emph{Standard}:
914 Non-elemental function
917 @code{RESULT = AND(X, Y)}
919 @item @emph{Arguments}:
920 @multitable @columnfractions .15 .80
921 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
922 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
925 @item @emph{Return value}:
926 The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
927 cross-promotion of the arguments.
929 @item @emph{Example}:
932 LOGICAL :: T = .TRUE., F = ..FALSE.
934 DATA a / Z'F' /, b / Z'3' /
936 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
937 WRITE (*,*) AND(a, b)
941 @item @emph{See also}:
942 F95 elemental function: @ref{IAND}
948 @section @code{ANINT} --- Nearest whole number
949 @findex @code{ANINT} intrinsic
950 @findex @code{DNINT} intrinsic
954 @item @emph{Description}:
955 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
957 @item @emph{Standard}:
965 @code{X = ANINT(X, KIND)}
967 @item @emph{Arguments}:
968 @multitable @columnfractions .15 .80
969 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
970 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
971 initialization expression.
974 @item @emph{Return value}:
975 The return value is of type real with the kind type parameter of the
976 argument if the optional @var{KIND} is absent; otherwise, the kind
977 type parameter will be given by @var{KIND}. If @var{X} is greater than
978 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
979 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
981 @item @emph{Example}:
988 print *, anint(x4), dnint(x8)
990 end program test_anint
993 @item @emph{Specific names}:
994 @multitable @columnfractions .20 .20 .20 .40
995 @item Name @tab Argument @tab Return type @tab Standard
996 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1003 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
1004 @findex @code{ANY} intrinsic
1008 @item @emph{Description}:
1009 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1010 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
1012 @item @emph{Standard}:
1016 transformational function
1018 @item @emph{Syntax}:
1019 @code{L = ANY(MASK)}
1020 @code{L = ANY(MASK, DIM)}
1022 @item @emph{Arguments}:
1023 @multitable @columnfractions .15 .80
1024 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1025 it shall not be scalar.
1026 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
1027 with a value that lies between one and the rank of @var{MASK}.
1030 @item @emph{Return value}:
1031 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1032 the kind type parameter is the same as the kind type parameter of
1033 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1034 an array with the rank of @var{MASK} minus 1. The shape is determined from
1035 the shape of @var{MASK} where the @var{DIM} dimension is elided.
1039 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
1040 otherwise, it is false. It also is false if @var{MASK} has zero size.
1042 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1043 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
1044 is determined by applying @code{ANY} to the array sections.
1047 @item @emph{Example}:
1051 l = any((/.true., .true., .true./))
1056 integer a(2,3), b(2,3)
1060 print *, any(a .eq. b, 1)
1061 print *, any(a .eq. b, 2)
1062 end subroutine section
1063 end program test_any
1070 @section @code{ASIN} --- Arcsine function
1071 @findex @code{ASIN} intrinsic
1072 @findex @code{DASIN} intrinsic
1073 @cindex trigonometric functions (inverse)
1076 @item @emph{Description}:
1077 @code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
1079 @item @emph{Standard}:
1085 @item @emph{Syntax}:
1088 @item @emph{Arguments}:
1089 @multitable @columnfractions .15 .80
1090 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1094 @item @emph{Return value}:
1095 The return value is of type @code{REAL(*)} and it lies in the
1096 range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}. The kind type
1097 parameter is the same as @var{X}.
1099 @item @emph{Example}:
1102 real(8) :: x = 0.866_8
1104 end program test_asin
1107 @item @emph{Specific names}:
1108 @multitable @columnfractions .20 .20 .20 .40
1109 @item Name @tab Argument @tab Return type @tab Standard
1110 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1113 @item @emph{See also}:
1114 Inverse function: @ref{SIN}
1120 @section @code{ASINH} --- Hyperbolic arcsine function
1121 @findex @code{ASINH} intrinsic
1122 @cindex hyperbolic arcsine
1123 @cindex hyperbolic sine (inverse)
1126 @item @emph{Description}:
1127 @code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1129 @item @emph{Standard}:
1135 @item @emph{Syntax}:
1138 @item @emph{Arguments}:
1139 @multitable @columnfractions .15 .80
1140 @item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1143 @item @emph{Return value}:
1144 The return value is of type @code{REAL(*)} and it lies in the
1145 range @math{-\infty \leq \asinh (x) \leq \infty}.
1147 @item @emph{Example}:
1150 REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1151 WRITE (*,*) ASINH(x)
1155 @item @emph{See also}:
1156 Inverse function: @ref{SINH}
1162 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
1163 @findex @code{ASSOCIATED} intrinsic
1164 @cindex pointer status
1167 @item @emph{Description}:
1168 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1169 or if @var{PTR} is associated with the target @var{TGT}.
1171 @item @emph{Standard}:
1177 @item @emph{Syntax}:
1178 @code{L = ASSOCIATED(PTR)}
1179 @code{L = ASSOCIATED(PTR [, TGT])}
1181 @item @emph{Arguments}:
1182 @multitable @columnfractions .15 .80
1183 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1184 it can be of any type.
1185 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1186 a @code{TARGET}. It must have the same type, kind type parameter, and
1187 array rank as @var{PTR}.
1189 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1191 @item @emph{Return value}:
1192 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1193 There are several cases:
1195 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1196 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1197 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1199 is not a 0 sized storage sequence and the target associated with @var{PTR}
1200 occupies the same storage units. If @var{PTR} is disassociated, then the
1202 @item (C) If @var{TGT} is present and an array target, the result is true if
1203 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1204 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1205 @var{PTR} occupy the same storage units in array element order.
1206 As in case(B), the result is false, if @var{PTR} is disassociated.
1207 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1208 target associated with @var{PTR} and the target associated with @var{TGT}
1209 are not 0 sized storage sequences and occupy the same storage units.
1210 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1211 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1212 target associated with @var{PTR} and the target associated with @var{TGT}
1213 have the same shape, are not 0 sized arrays, are arrays whose elements are
1214 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1215 storage units in array element order.
1216 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1219 @item @emph{Example}:
1221 program test_associated
1223 real, target :: tgt(2) = (/1., 2./)
1224 real, pointer :: ptr(:)
1226 if (associated(ptr) .eqv. .false.) call abort
1227 if (associated(ptr,tgt) .eqv. .false.) call abort
1228 end program test_associated
1231 @item @emph{See also}:
1238 @section @code{ATAN} --- Arctangent function
1239 @findex @code{ATAN} intrinsic
1240 @findex @code{DATAN} intrinsic
1241 @cindex trigonometric functions (inverse)
1244 @item @emph{Description}:
1245 @code{ATAN(X)} computes the arctangent of @var{X}.
1247 @item @emph{Standard}:
1253 @item @emph{Syntax}:
1256 @item @emph{Arguments}:
1257 @multitable @columnfractions .15 .80
1258 @item @var{X} @tab The type shall be @code{REAL(*)}.
1261 @item @emph{Return value}:
1262 The return value is of type @code{REAL(*)} and it lies in the
1263 range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
1265 @item @emph{Example}:
1268 real(8) :: x = 2.866_8
1270 end program test_atan
1273 @item @emph{Specific names}:
1274 @multitable @columnfractions .20 .20 .20 .40
1275 @item Name @tab Argument @tab Return type @tab Standard
1276 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1279 @item @emph{See also}:
1280 Inverse function: @ref{TAN}
1287 @section @code{ATAN2} --- Arctangent function
1288 @findex @code{ATAN2} intrinsic
1289 @findex @code{DATAN2} intrinsic
1290 @cindex trigonometric functions (inverse)
1293 @item @emph{Description}:
1294 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1296 @item @emph{Standard}:
1302 @item @emph{Syntax}:
1303 @code{X = ATAN2(Y,X)}
1305 @item @emph{Arguments}:
1306 @multitable @columnfractions .15 .80
1307 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1308 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1309 If @var{Y} is zero, then @var{X} must be nonzero.
1312 @item @emph{Return value}:
1313 The return value has the same type and kind type parameter as @var{Y}.
1314 It is the principal value of the complex number @math{X + i Y}. If
1315 @var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
1316 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
1317 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1318 is negative. Finally, if @var{X} is zero, then the magnitude of the result
1321 @item @emph{Example}:
1324 real(4) :: x = 1.e0_4, y = 0.5e0_4
1326 end program test_atan2
1329 @item @emph{Specific names}:
1330 @multitable @columnfractions .20 .20 .20 .40
1331 @item Name @tab Argument @tab Return type @tab Standard
1332 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1339 @section @code{ATANH} --- Hyperbolic arctangent function
1340 @findex @code{ASINH} intrinsic
1341 @cindex hyperbolic arctangent
1342 @cindex hyperbolic tangent (inverse)
1345 @item @emph{Description}:
1346 @code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1348 @item @emph{Standard}:
1354 @item @emph{Syntax}:
1357 @item @emph{Arguments}:
1358 @multitable @columnfractions .15 .80
1359 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is less than or equal to one.
1362 @item @emph{Return value}:
1363 The return value is of type @code{REAL(*)} and it lies in the
1364 range @math{-\infty \leq \atanh(x) \leq \infty}.
1366 @item @emph{Example}:
1369 REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1370 WRITE (*,*) ATANH(x)
1374 @item @emph{See also}:
1375 Inverse function: @ref{TANH}
1382 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1383 @findex @code{BESJ0} intrinsic
1384 @findex @code{DBESJ0} intrinsic
1388 @item @emph{Description}:
1389 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1392 @item @emph{Standard}:
1398 @item @emph{Syntax}:
1401 @item @emph{Arguments}:
1402 @multitable @columnfractions .15 .80
1403 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1406 @item @emph{Return value}:
1407 The return value is of type @code{REAL(*)} and it lies in the
1408 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1410 @item @emph{Example}:
1413 real(8) :: x = 0.0_8
1415 end program test_besj0
1418 @item @emph{Specific names}:
1419 @multitable @columnfractions .20 .20 .20 .40
1420 @item Name @tab Argument @tab Return type @tab Standard
1421 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1428 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1429 @findex @code{BESJ1} intrinsic
1430 @findex @code{DBESJ1} intrinsic
1434 @item @emph{Description}:
1435 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1438 @item @emph{Standard}:
1444 @item @emph{Syntax}:
1447 @item @emph{Arguments}:
1448 @multitable @columnfractions .15 .80
1449 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1452 @item @emph{Return value}:
1453 The return value is of type @code{REAL(*)} and it lies in the
1454 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1456 @item @emph{Example}:
1459 real(8) :: x = 1.0_8
1461 end program test_besj1
1464 @item @emph{Specific names}:
1465 @multitable @columnfractions .20 .20 .20 .40
1466 @item Name @tab Argument @tab Return type @tab Standard
1467 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1474 @section @code{BESJN} --- Bessel function of the first kind
1475 @findex @code{BESJN} intrinsic
1476 @findex @code{DBESJN} intrinsic
1480 @item @emph{Description}:
1481 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1484 @item @emph{Standard}:
1490 @item @emph{Syntax}:
1491 @code{Y = BESJN(N, X)}
1493 @item @emph{Arguments}:
1494 @multitable @columnfractions .15 .80
1495 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1496 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1499 @item @emph{Return value}:
1500 The return value is a scalar of type @code{REAL(*)}.
1502 @item @emph{Example}:
1505 real(8) :: x = 1.0_8
1507 end program test_besjn
1510 @item @emph{Specific names}:
1511 @multitable @columnfractions .20 .20 .20 .40
1512 @item Name @tab Argument @tab Return type @tab Standard
1513 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1514 @item @tab @code{REAL(8) X} @tab @tab
1521 @section @code{BESY0} --- Bessel function of the second kind of order 0
1522 @findex @code{BESY0} intrinsic
1523 @findex @code{DBESY0} intrinsic
1527 @item @emph{Description}:
1528 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1531 @item @emph{Standard}:
1537 @item @emph{Syntax}:
1540 @item @emph{Arguments}:
1541 @multitable @columnfractions .15 .80
1542 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1545 @item @emph{Return value}:
1546 The return value is a scalar of type @code{REAL(*)}.
1548 @item @emph{Example}:
1551 real(8) :: x = 0.0_8
1553 end program test_besy0
1556 @item @emph{Specific names}:
1557 @multitable @columnfractions .20 .20 .20 .40
1558 @item Name @tab Argument @tab Return type @tab Standard
1559 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1566 @section @code{BESY1} --- Bessel function of the second kind of order 1
1567 @findex @code{BESY1} intrinsic
1568 @findex @code{DBESY1} intrinsic
1572 @item @emph{Description}:
1573 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1576 @item @emph{Standard}:
1582 @item @emph{Syntax}:
1585 @item @emph{Arguments}:
1586 @multitable @columnfractions .15 .80
1587 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1590 @item @emph{Return value}:
1591 The return value is a scalar of type @code{REAL(*)}.
1593 @item @emph{Example}:
1596 real(8) :: x = 1.0_8
1598 end program test_besy1
1601 @item @emph{Specific names}:
1602 @multitable @columnfractions .20 .20 .20 .40
1603 @item Name @tab Argument @tab Return type @tab Standard
1604 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1611 @section @code{BESYN} --- Bessel function of the second kind
1612 @findex @code{BESYN} intrinsic
1613 @findex @code{DBESYN} intrinsic
1617 @item @emph{Description}:
1618 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1621 @item @emph{Standard}:
1627 @item @emph{Syntax}:
1628 @code{Y = BESYN(N, X)}
1630 @item @emph{Arguments}:
1631 @multitable @columnfractions .15 .80
1632 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1633 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1636 @item @emph{Return value}:
1637 The return value is a scalar of type @code{REAL(*)}.
1639 @item @emph{Example}:
1642 real(8) :: x = 1.0_8
1644 end program test_besyn
1647 @item @emph{Specific names}:
1648 @multitable @columnfractions .20 .20 .20 .40
1649 @item Name @tab Argument @tab Return type @tab Standard
1650 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1651 @item @tab @code{REAL(8) X} @tab @tab
1658 @section @code{BIT_SIZE} --- Bit size inquiry function
1659 @findex @code{BIT_SIZE} intrinsic
1663 @item @emph{Description}:
1664 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1665 represented by the type of @var{I}.
1667 @item @emph{Standard}:
1673 @item @emph{Syntax}:
1674 @code{I = BIT_SIZE(I)}
1676 @item @emph{Arguments}:
1677 @multitable @columnfractions .15 .80
1678 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1681 @item @emph{Return value}:
1682 The return value is of type @code{INTEGER(*)}
1684 @item @emph{Example}:
1686 program test_bit_size
1691 end program test_bit_size
1698 @section @code{BTEST} --- Bit test function
1699 @findex @code{BTEST} intrinsic
1700 @cindex bit operations
1703 @item @emph{Description}:
1704 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1707 @item @emph{Standard}:
1713 @item @emph{Syntax}:
1714 @code{I = BTEST(I,POS)}
1716 @item @emph{Arguments}:
1717 @multitable @columnfractions .15 .80
1718 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1719 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1722 @item @emph{Return value}:
1723 The return value is of type @code{LOGICAL}
1725 @item @emph{Example}:
1728 integer :: i = 32768 + 1024 + 64
1732 bool = btest(i, pos)
1735 end program test_btest
1742 @section @code{CEILING} --- Integer ceiling function
1743 @findex @code{CEILING} intrinsic
1747 @item @emph{Description}:
1748 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1750 @item @emph{Standard}:
1756 @item @emph{Syntax}:
1757 @code{I = CEILING(X[,KIND])}
1759 @item @emph{Arguments}:
1760 @multitable @columnfractions .15 .80
1761 @item @var{X} @tab The type shall be @code{REAL(*)}.
1762 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1765 @item @emph{Return value}:
1766 The return value is of type @code{INTEGER(KIND)}
1768 @item @emph{Example}:
1770 program test_ceiling
1773 print *, ceiling(x) ! returns 64
1774 print *, ceiling(y) ! returns -63
1775 end program test_ceiling
1778 @item @emph{See also}:
1779 @ref{FLOOR}, @ref{NINT}
1786 @section @code{CHAR} --- Character conversion function
1787 @findex @code{CHAR} intrinsic
1788 @cindex conversion function (character)
1791 @item @emph{Description}:
1792 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1794 @item @emph{Standard}:
1800 @item @emph{Syntax}:
1801 @code{C = CHAR(I[,KIND])}
1803 @item @emph{Arguments}:
1804 @multitable @columnfractions .15 .80
1805 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1806 @item @var{KIND} @tab Optional scaler integer initialization expression.
1809 @item @emph{Return value}:
1810 The return value is of type @code{CHARACTER(1)}
1812 @item @emph{Example}:
1818 print *, i, c ! returns 'J'
1819 end program test_char
1822 @item @emph{See also}:
1823 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1829 @section @code{CHDIR} --- Change working directory
1830 @findex @code{CHDIR} intrinsic
1831 @cindex file system functions
1834 @item @emph{Description}:
1835 Change current working directory to a specified @var{PATH}.
1837 @item @emph{Standard}:
1841 Non-elemental subroutine
1843 @item @emph{Syntax}:
1844 @code{CALL chdir(PATH[,STATUS])}
1846 @item @emph{Arguments}:
1847 @multitable @columnfractions .15 .80
1848 @item @var{PATH} @tab The type shall be @code{CHARACTER(*)} and shall specify a valid path within the file system.
1849 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
1850 a system specific and non-zero error code otherwise.
1853 @item @emph{Example}:
1856 CHARACTER(len=255) :: path
1858 WRITE(*,*) TRIM(path)
1861 WRITE(*,*) TRIM(path)
1865 @item @emph{See also}:
1872 @section @code{CHMOD} --- Change access permissions of files
1873 @findex @code{CHMOD}
1874 @cindex file system functions
1876 Not yet implemented in GNU Fortran.
1879 @item @emph{Description}:
1881 @item @emph{Standard}:
1887 @item @emph{Syntax}:
1888 @item @emph{Arguments}:
1889 @item @emph{Return value}:
1890 @item @emph{Example}:
1891 @item @emph{Specific names}:
1892 @item @emph{See also}:
1898 @section @code{CMPLX} --- Complex conversion function
1899 @findex @code{CMPLX} intrinsic
1903 @item @emph{Description}:
1904 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1905 the real component. If @var{Y} is present it is converted to the imaginary
1906 component. If @var{Y} is not present then the imaginary component is set to
1907 0.0. If @var{X} is complex then @var{Y} must not be present.
1909 @item @emph{Standard}:
1915 @item @emph{Syntax}:
1916 @code{C = CMPLX(X[,Y[,KIND]])}
1918 @item @emph{Arguments}:
1919 @multitable @columnfractions .15 .80
1920 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1921 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1922 @item @var{KIND} @tab Optional scaler integer initialization expression.
1925 @item @emph{Return value}:
1926 The return value is of type @code{COMPLEX(*)}
1928 @item @emph{Example}:
1935 print *, z, cmplx(x)
1936 end program test_cmplx
1942 @node COMMAND_ARGUMENT_COUNT
1943 @section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
1944 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1945 @cindex command line arguments
1949 @item @emph{Description}:
1950 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1951 command line when the containing program was invoked.
1953 @item @emph{Standard}:
1959 @item @emph{Syntax}:
1960 @code{I = COMMAND_ARGUMENT_COUNT()}
1962 @item @emph{Arguments}:
1963 @multitable @columnfractions .15 .80
1967 @item @emph{Return value}:
1968 The return value is of type @code{INTEGER(4)}
1970 @item @emph{Example}:
1972 program test_command_argument_count
1974 count = command_argument_count()
1976 end program test_command_argument_count
1979 @item @emph{See also}:
1980 @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
1984 @section @code{CONJG} --- Complex conjugate function
1985 @findex @code{CONJG} intrinsic
1986 @findex @code{DCONJG} intrinsic
1987 @cindex complex conjugate
1989 @item @emph{Description}:
1990 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
1991 then the result is @code{(x, -y)}
1993 @item @emph{Standard}:
1994 F77 and later, has overloads that are GNU extensions
1999 @item @emph{Syntax}:
2002 @item @emph{Arguments}:
2003 @multitable @columnfractions .15 .80
2004 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2007 @item @emph{Return value}:
2008 The return value is of type @code{COMPLEX(*)}.
2010 @item @emph{Example}:
2013 complex :: z = (2.0, 3.0)
2014 complex(8) :: dz = (2.71_8, -3.14_8)
2019 end program test_conjg
2022 @item @emph{Specific names}:
2023 @multitable @columnfractions .20 .20 .20 .40
2024 @item Name @tab Argument @tab Return type @tab Standard
2025 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
2032 @section @code{COS} --- Cosine function
2033 @findex @code{COS} intrinsic
2034 @findex @code{DCOS} intrinsic
2035 @findex @code{ZCOS} intrinsic
2036 @findex @code{CDCOS} intrinsic
2037 @cindex trigonometric functions
2040 @item @emph{Description}:
2041 @code{COS(X)} computes the cosine of @var{X}.
2043 @item @emph{Standard}:
2044 F77 and later, has overloads that are GNU extensions
2049 @item @emph{Syntax}:
2052 @item @emph{Arguments}:
2053 @multitable @columnfractions .15 .80
2054 @item @var{X} @tab The type shall be @code{REAL(*)} or
2058 @item @emph{Return value}:
2059 The return value is of type @code{REAL(*)} and it lies in the
2060 range @math{ -1 \leq \cos (x) \leq 1}. The kind type
2061 parameter is the same as @var{X}.
2063 @item @emph{Example}:
2068 end program test_cos
2071 @item @emph{Specific names}:
2072 @multitable @columnfractions .20 .20 .20 .40
2073 @item Name @tab Argument @tab Return type @tab Standard
2074 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2075 @item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2076 @item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2077 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2080 @item @emph{See also}:
2081 Inverse function: @ref{ACOS}
2088 @section @code{COSH} --- Hyperbolic cosine function
2089 @findex @code{COSH} intrinsic
2090 @findex @code{DCOSH} intrinsic
2091 @cindex hyperbolic cosine
2094 @item @emph{Description}:
2095 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2097 @item @emph{Standard}:
2103 @item @emph{Syntax}:
2106 @item @emph{Arguments}:
2107 @multitable @columnfractions .15 .80
2108 @item @var{X} @tab The type shall be @code{REAL(*)}.
2111 @item @emph{Return value}:
2112 The return value is of type @code{REAL(*)} and it is positive
2113 (@math{ \cosh (x) \geq 0 }.
2115 @item @emph{Example}:
2118 real(8) :: x = 1.0_8
2120 end program test_cosh
2123 @item @emph{Specific names}:
2124 @multitable @columnfractions .20 .20 .20 .40
2125 @item Name @tab Argument @tab Return type @tab Standard
2126 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2129 @item @emph{See also}:
2130 Inverse function: @ref{ACOSH}
2137 @section @code{COUNT} --- Count function
2138 @findex @code{COUNT} intrinsic
2142 @item @emph{Description}:
2143 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2144 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2145 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2146 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2148 @item @emph{Standard}:
2152 transformational function
2154 @item @emph{Syntax}:
2155 @code{I = COUNT(MASK[,DIM])}
2157 @item @emph{Arguments}:
2158 @multitable @columnfractions .15 .80
2159 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2160 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2163 @item @emph{Return value}:
2164 The return value is of type @code{INTEGER} with rank equal to that of
2167 @item @emph{Example}:
2170 integer, dimension(2,3) :: a, b
2171 logical, dimension(2,3) :: mask
2172 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2173 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2174 print '(3i3)', a(1,:)
2175 print '(3i3)', a(2,:)
2177 print '(3i3)', b(1,:)
2178 print '(3i3)', b(2,:)
2181 print '(3l3)', mask(1,:)
2182 print '(3l3)', mask(2,:)
2184 print '(3i3)', count(mask)
2186 print '(3i3)', count(mask, 1)
2188 print '(3i3)', count(mask, 2)
2189 end program test_count
2196 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2197 @findex @code{CPU_TIME} intrinsic
2201 @item @emph{Description}:
2202 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
2203 is useful for testing segments of code to determine execution time.
2205 @item @emph{Standard}:
2211 @item @emph{Syntax}:
2214 @item @emph{Arguments}:
2215 @multitable @columnfractions .15 .80
2216 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2219 @item @emph{Return value}:
2222 @item @emph{Example}:
2224 program test_cpu_time
2225 real :: start, finish
2226 call cpu_time(start)
2227 ! put code to test here
2228 call cpu_time(finish)
2229 print '("Time = ",f6.3," seconds.")',finish-start
2230 end program test_cpu_time
2237 @section @code{CSHIFT} --- Circular shift function
2238 @findex @code{CSHIFT} intrinsic
2239 @cindex bit manipulation
2242 @item @emph{Description}:
2243 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2244 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2245 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2246 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2247 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2248 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
2249 sections of @var{ARRAY} along the given dimension are shifted. Elements
2250 shifted out one end of each rank one section are shifted back in the other end.
2252 @item @emph{Standard}:
2256 transformational function
2258 @item @emph{Syntax}:
2259 @code{A = CSHIFT(A, SHIFT[,DIM])}
2261 @item @emph{Arguments}:
2262 @multitable @columnfractions .15 .80
2263 @item @var{ARRAY} @tab May be any type, not scaler.
2264 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2265 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2268 @item @emph{Return value}:
2269 Returns an array of same type and rank as the @var{ARRAY} argument.
2271 @item @emph{Example}:
2274 integer, dimension(3,3) :: a
2275 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2276 print '(3i3)', a(1,:)
2277 print '(3i3)', a(2,:)
2278 print '(3i3)', a(3,:)
2279 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2281 print '(3i3)', a(1,:)
2282 print '(3i3)', a(2,:)
2283 print '(3i3)', a(3,:)
2284 end program test_cshift
2290 @section @code{CTIME} --- Convert a time into a string
2291 @findex @code{CTIME} intrinsic
2292 @cindex ctime subroutine
2295 @item @emph{Description}:
2296 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2297 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2298 1995}, and returns that string into @var{S}.
2300 If @code{CTIME} is invoked as a function, it can not be invoked as a
2301 subroutine, and vice versa.
2303 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2304 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2306 @item @emph{Standard}:
2312 @item @emph{Syntax}:
2313 @multitable @columnfractions .80
2314 @item @code{CALL CTIME(T,S)}.
2315 @item @code{S = CTIME(T)}, (not recommended).
2318 @item @emph{Arguments}:
2319 @multitable @columnfractions .15 .80
2320 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2321 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2324 @item @emph{Return value}:
2325 The converted date and time as a string.
2327 @item @emph{Example}:
2331 character(len=30) :: date
2334 ! Do something, main part of the program
2337 print *, 'Program was started on ', date
2338 end program test_ctime
2343 @section @code{DATE_AND_TIME} --- Date and time subroutine
2344 @findex @code{DATE_AND_TIME} intrinsic
2345 @cindex DATE_AND_TIME
2348 @item @emph{Description}:
2349 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2350 time information from the real-time system clock. @var{DATE} is
2351 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
2352 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2353 representing the difference with respect to Coordinated Universal Time (UTC).
2354 Unavailable time and date parameters return blanks.
2356 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2358 @multitable @columnfractions .15 .30 .60
2359 @item @tab @code{VALUE(1)}: @tab The year
2360 @item @tab @code{VALUE(2)}: @tab The month
2361 @item @tab @code{VALUE(3)}: @tab The day of the month
2362 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2363 @item @tab @code{VALUE(5)}: @tab The hour of the day
2364 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2365 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2366 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2369 @item @emph{Standard}:
2375 @item @emph{Syntax}:
2376 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2378 @item @emph{Arguments}:
2379 @multitable @columnfractions .15 .80
2380 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2381 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2382 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2383 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2386 @item @emph{Return value}:
2389 @item @emph{Example}:
2391 program test_time_and_date
2392 character(8) :: date
2393 character(10) :: time
2394 character(5) :: zone
2395 integer,dimension(8) :: values
2396 ! using keyword arguments
2397 call date_and_time(date,time,zone,values)
2398 call date_and_time(DATE=date,ZONE=zone)
2399 call date_and_time(TIME=time)
2400 call date_and_time(VALUES=values)
2401 print '(a,2x,a,2x,a)', date, time, zone
2402 print '(8i5))', values
2403 end program test_time_and_date
2410 @section @code{DBLE} --- Double conversion function
2411 @findex @code{DBLE} intrinsic
2412 @cindex double conversion
2415 @item @emph{Description}:
2416 @code{DBLE(X)} Converts @var{X} to double precision real type.
2418 @item @emph{Standard}:
2424 @item @emph{Syntax}:
2427 @item @emph{Arguments}:
2428 @multitable @columnfractions .15 .80
2429 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2432 @item @emph{Return value}:
2433 The return value is of type double precision real.
2435 @item @emph{Example}:
2440 complex :: z = (2.3,1.14)
2441 print *, dble(x), dble(i), dble(z)
2442 end program test_dble
2445 @item @emph{See also}:
2446 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2452 @section @code{DCMPLX} --- Double complex conversion function
2453 @findex @code{DCMPLX} intrinsic
2457 @item @emph{Description}:
2458 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2459 converted to the real component. If @var{Y} is present it is converted to the
2460 imaginary component. If @var{Y} is not present then the imaginary component is
2461 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
2463 @item @emph{Standard}:
2469 @item @emph{Syntax}:
2470 @code{C = DCMPLX(X)}
2471 @code{C = DCMPLX(X,Y)}
2473 @item @emph{Arguments}:
2474 @multitable @columnfractions .15 .80
2475 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2476 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
2479 @item @emph{Return value}:
2480 The return value is of type @code{COMPLEX(8)}
2482 @item @emph{Example}:
2492 print *, dcmplx(x,i)
2493 end program test_dcmplx
2500 @section @code{DFLOAT} --- Double conversion function
2501 @findex @code{DFLOAT} intrinsic
2502 @cindex double float conversion
2505 @item @emph{Description}:
2506 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2508 @item @emph{Standard}:
2514 @item @emph{Syntax}:
2515 @code{X = DFLOAT(X)}
2517 @item @emph{Arguments}:
2518 @multitable @columnfractions .15 .80
2519 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2522 @item @emph{Return value}:
2523 The return value is of type double precision real.
2525 @item @emph{Example}:
2530 end program test_dfloat
2533 @item @emph{See also}:
2534 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2540 @section @code{DIGITS} --- Significant digits function
2541 @findex @code{DIGITS} intrinsic
2542 @cindex digits, significant
2545 @item @emph{Description}:
2546 @code{DIGITS(X)} returns the number of significant digits of the internal model
2547 representation of @var{X}. For example, on a system using a 32-bit
2548 floating point representation, a default real number would likely return 24.
2550 @item @emph{Standard}:
2556 @item @emph{Syntax}:
2557 @code{C = DIGITS(X)}
2559 @item @emph{Arguments}:
2560 @multitable @columnfractions .15 .80
2561 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2564 @item @emph{Return value}:
2565 The return value is of type @code{INTEGER}.
2567 @item @emph{Example}:
2570 integer :: i = 12345
2576 end program test_digits
2583 @section @code{DIM} --- Dim function
2584 @findex @code{DIM} intrinsic
2585 @findex @code{IDIM} intrinsic
2586 @findex @code{DDIM} intrinsic
2590 @item @emph{Description}:
2591 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2592 otherwise returns zero.
2594 @item @emph{Standard}:
2600 @item @emph{Syntax}:
2603 @item @emph{Arguments}:
2604 @multitable @columnfractions .15 .80
2605 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2606 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2609 @item @emph{Return value}:
2610 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2612 @item @emph{Example}:
2618 x = dim(4.345_8, 2.111_8)
2621 end program test_dim
2624 @item @emph{Specific names}:
2625 @multitable @columnfractions .20 .20 .20 .40
2626 @item Name @tab Argument @tab Return type @tab Standard
2627 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2628 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab F77 and later
2635 @section @code{DOT_PRODUCT} --- Dot product function
2636 @findex @code{DOT_PRODUCT} intrinsic
2640 @item @emph{Description}:
2641 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2642 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2643 and must be arrays of rank one and of equal size. If the vectors are
2644 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2645 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2646 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2648 @item @emph{Standard}:
2652 transformational function
2654 @item @emph{Syntax}:
2655 @code{S = DOT_PRODUCT(X,Y)}
2657 @item @emph{Arguments}:
2658 @multitable @columnfractions .15 .80
2659 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2660 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2663 @item @emph{Return value}:
2664 If the arguments are numeric, the return value is a scaler of numeric type,
2665 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2666 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2668 @item @emph{Example}:
2670 program test_dot_prod
2671 integer, dimension(3) :: a, b
2678 print *, dot_product(a,b)
2679 end program test_dot_prod
2686 @section @code{DPROD} --- Double product function
2687 @findex @code{DPROD} intrinsic
2688 @cindex Double product
2691 @item @emph{Description}:
2692 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2694 @item @emph{Standard}:
2700 @item @emph{Syntax}:
2701 @code{D = DPROD(X,Y)}
2703 @item @emph{Arguments}:
2704 @multitable @columnfractions .15 .80
2705 @item @var{X} @tab The type shall be @code{REAL}.
2706 @item @var{Y} @tab The type shall be @code{REAL}.
2709 @item @emph{Return value}:
2710 The return value is of type @code{REAL(8)}.
2712 @item @emph{Example}:
2721 end program test_dprod
2728 @section @code{DREAL} --- Double real part function
2729 @findex @code{DREAL} intrinsic
2730 @cindex Double real part
2733 @item @emph{Description}:
2734 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2736 @item @emph{Standard}:
2742 @item @emph{Syntax}:
2745 @item @emph{Arguments}:
2746 @multitable @columnfractions .15 .80
2747 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2750 @item @emph{Return value}:
2751 The return value is of type @code{REAL(8)}.
2753 @item @emph{Example}:
2756 complex(8) :: z = (1.3_8,7.2_8)
2758 end program test_dreal
2761 @item @emph{See also}:
2769 @section @code{DTIME} --- Execution time subroutine (or function)
2770 @findex @code{DTIME} intrinsic
2771 @cindex dtime subroutine
2774 @item @emph{Description}:
2775 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2776 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2777 returns the user and system components of this time in @code{TARRAY(1)} and
2778 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2781 Subsequent invocations of @code{DTIME} return values accumulated since the
2782 previous invocation.
2784 On some systems, the underlying timings are represented using types with
2785 sufficiently small limits that overflows (wrap around) are possible, such as
2786 32-bit types. Therefore, the values returned by this intrinsic might be, or
2787 become, negative, or numerically less than previous values, during a single
2788 run of the compiled program.
2790 If @code{DTIME} is invoked as a function, it can not be invoked as a
2791 subroutine, and vice versa.
2793 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2795 @multitable @columnfractions .15 .30 .60
2796 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2797 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2798 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2801 @item @emph{Standard}:
2807 @item @emph{Syntax}:
2808 @multitable @columnfractions .80
2809 @item @code{CALL DTIME(TARRAY, RESULT)}.
2810 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2813 @item @emph{Arguments}:
2814 @multitable @columnfractions .15 .80
2815 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2816 @item @var{RESULT}@tab The type shall be @code{REAL}.
2819 @item @emph{Return value}:
2820 Elapsed time in seconds since the start of program execution.
2822 @item @emph{Example}:
2826 real, dimension(2) :: tarray
2828 call dtime(tarray, result)
2832 do i=1,100000000 ! Just a delay
2835 call dtime(tarray, result)
2839 end program test_dtime
2846 @section @code{EOSHIFT} --- End-off shift function
2847 @findex @code{EOSHIFT} intrinsic
2848 @cindex bit manipulation
2851 @item @emph{Description}:
2852 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2853 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2854 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2855 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2856 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2857 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2858 then all complete rank one sections of @var{ARRAY} along the given dimension are
2859 shifted. Elements shifted out one end of each rank one section are dropped. If
2860 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2861 is copied back in the other end. If @var{BOUNDARY} is not present then the
2862 following are copied in depending on the type of @var{ARRAY}.
2864 @multitable @columnfractions .15 .80
2865 @item @emph{Array Type} @tab @emph{Boundary Value}
2866 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2867 @item Logical @tab @code{.FALSE.}.
2868 @item Character(@var{len}) @tab @var{len} blanks.
2871 @item @emph{Standard}:
2875 transformational function
2877 @item @emph{Syntax}:
2878 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2880 @item @emph{Arguments}:
2881 @multitable @columnfractions .15 .80
2882 @item @var{ARRAY} @tab May be any type, not scaler.
2883 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2884 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2885 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2888 @item @emph{Return value}:
2889 Returns an array of same type and rank as the @var{ARRAY} argument.
2891 @item @emph{Example}:
2893 program test_eoshift
2894 integer, dimension(3,3) :: a
2895 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2896 print '(3i3)', a(1,:)
2897 print '(3i3)', a(2,:)
2898 print '(3i3)', a(3,:)
2899 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2901 print '(3i3)', a(1,:)
2902 print '(3i3)', a(2,:)
2903 print '(3i3)', a(3,:)
2904 end program test_eoshift
2911 @section @code{EPSILON} --- Epsilon function
2912 @findex @code{EPSILON} intrinsic
2913 @cindex epsilon, significant
2916 @item @emph{Description}:
2917 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2919 @item @emph{Standard}:
2925 @item @emph{Syntax}:
2926 @code{C = EPSILON(X)}
2928 @item @emph{Arguments}:
2929 @multitable @columnfractions .15 .80
2930 @item @var{X} @tab The type shall be @code{REAL(*)}.
2933 @item @emph{Return value}:
2934 The return value is of same type as the argument.
2936 @item @emph{Example}:
2938 program test_epsilon
2943 end program test_epsilon
2950 @section @code{ERF} --- Error function
2951 @findex @code{ERF} intrinsic
2952 @cindex error function
2955 @item @emph{Description}:
2956 @code{ERF(X)} computes the error function of @var{X}.
2958 @item @emph{Standard}:
2964 @item @emph{Syntax}:
2967 @item @emph{Arguments}:
2968 @multitable @columnfractions .15 .80
2969 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2972 @item @emph{Return value}:
2973 The return value is a scalar of type @code{REAL(*)} and it is positive
2974 (@math{ - 1 \leq erf (x) \leq 1 }.
2976 @item @emph{Example}:
2979 real(8) :: x = 0.17_8
2981 end program test_erf
2984 @item @emph{Specific names}:
2985 @multitable @columnfractions .20 .20 .20 .40
2986 @item Name @tab Argument @tab Return type @tab Standard
2987 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
2994 @section @code{ERFC} --- Error function
2995 @findex @code{ERFC} intrinsic
2996 @cindex error function
2999 @item @emph{Description}:
3000 @code{ERFC(X)} computes the complementary error function of @var{X}.
3002 @item @emph{Standard}:
3008 @item @emph{Syntax}:
3011 @item @emph{Arguments}:
3012 @multitable @columnfractions .15 .80
3013 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3016 @item @emph{Return value}:
3017 The return value is a scalar of type @code{REAL(*)} and it is positive
3018 (@math{ 0 \leq erfc (x) \leq 2 }.
3020 @item @emph{Example}:
3023 real(8) :: x = 0.17_8
3025 end program test_erfc
3028 @item @emph{Specific names}:
3029 @multitable @columnfractions .20 .20 .20 .40
3030 @item Name @tab Argument @tab Return type @tab Standard
3031 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
3038 @section @code{ETIME} --- Execution time subroutine (or function)
3039 @findex @code{ETIME} intrinsic
3040 @cindex time functions
3043 @item @emph{Description}:
3044 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3045 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
3046 returns the user and system components of this time in @code{TARRAY(1)} and
3047 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3049 On some systems, the underlying timings are represented using types with
3050 sufficiently small limits that overflows (wrap around) are possible, such as
3051 32-bit types. Therefore, the values returned by this intrinsic might be, or
3052 become, negative, or numerically less than previous values, during a single
3053 run of the compiled program.
3055 If @code{ETIME} is invoked as a function, it can not be invoked as a
3056 subroutine, and vice versa.
3058 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3060 @multitable @columnfractions .15 .30 .60
3061 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3062 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3063 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3066 @item @emph{Standard}:
3072 @item @emph{Syntax}:
3073 @multitable @columnfractions .8
3074 @item @code{CALL ETIME(TARRAY, RESULT)}.
3075 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3078 @item @emph{Arguments}:
3079 @multitable @columnfractions .15 .80
3080 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3081 @item @var{RESULT}@tab The type shall be @code{REAL}.
3084 @item @emph{Return value}:
3085 Elapsed time in seconds since the start of program execution.
3087 @item @emph{Example}:
3091 real, dimension(2) :: tarray
3093 call ETIME(tarray, result)
3097 do i=1,100000000 ! Just a delay
3100 call ETIME(tarray, result)
3104 end program test_etime
3107 @item @emph{See also}:
3115 @section @code{EXIT} --- Exit the program with status.
3120 @item @emph{Description}:
3121 @code{EXIT} causes immediate termination of the program with status. If status
3122 is omitted it returns the canonical @emph{success} for the system. All Fortran
3123 I/O units are closed.
3125 @item @emph{Standard}:
3131 @item @emph{Syntax}:
3132 @code{CALL EXIT([STATUS])}
3134 @item @emph{Arguments}:
3135 @multitable @columnfractions .15 .80
3136 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3139 @item @emph{Return value}:
3140 @code{STATUS} is passed to the parent process on exit.
3142 @item @emph{Example}:
3145 integer :: STATUS = 0
3146 print *, 'This program is going to exit.'
3148 end program test_exit
3151 @item @emph{See also}:
3152 @ref{ABORT}, @ref{KILL}
3158 @section @code{EXP} --- Exponential function
3159 @findex @code{EXP} intrinsic
3160 @findex @code{DEXP} intrinsic
3161 @findex @code{ZEXP} intrinsic
3162 @findex @code{CDEXP} intrinsic
3166 @item @emph{Description}:
3167 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3169 @item @emph{Standard}:
3170 F77 and later, has overloads that are GNU extensions
3175 @item @emph{Syntax}:
3178 @item @emph{Arguments}:
3179 @multitable @columnfractions .15 .80
3180 @item @var{X} @tab The type shall be @code{REAL(*)} or
3184 @item @emph{Return value}:
3185 The return value has same type and kind as @var{X}.
3187 @item @emph{Example}:
3192 end program test_exp
3195 @item @emph{Specific names}:
3196 @multitable @columnfractions .20 .20 .20 .40
3197 @item Name @tab Argument @tab Return type @tab Standard
3198 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
3199 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
3200 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3201 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3208 @section @code{EXPONENT} --- Exponent function
3209 @findex @code{EXPONENT} intrinsic
3210 @cindex exponent function
3213 @item @emph{Description}:
3214 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3215 is zero the value returned is zero.
3217 @item @emph{Standard}:
3223 @item @emph{Syntax}:
3224 @code{I = EXPONENT(X)}
3226 @item @emph{Arguments}:
3227 @multitable @columnfractions .15 .80
3228 @item @var{X} @tab The type shall be @code{REAL(*)}.
3231 @item @emph{Return value}:
3232 The return value is of type default @code{INTEGER}.
3234 @item @emph{Example}:
3236 program test_exponent
3241 print *, exponent(0.0)
3242 end program test_exponent
3248 @section @code{FDATE} --- Get the current time as a string
3249 @findex @code{FDATE} intrinsic
3250 @cindex fdate subroutine
3253 @item @emph{Description}:
3254 @code{FDATE(DATE)} returns the current date (using the same format as
3255 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3258 If @code{FDATE} is invoked as a function, it can not be invoked as a
3259 subroutine, and vice versa.
3261 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3263 @item @emph{Standard}:
3269 @item @emph{Syntax}:
3270 @multitable @columnfractions .80
3271 @item @code{CALL FDATE(DATE)}.
3272 @item @code{DATE = FDATE()}, (not recommended).
3275 @item @emph{Arguments}:
3276 @multitable @columnfractions .15 .80
3277 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3280 @item @emph{Return value}:
3281 The current date and time as a string.
3283 @item @emph{Example}:
3287 character(len=30) :: date
3289 print *, 'Program started on ', date
3290 do i = 1, 100000000 ! Just a delay
3294 print *, 'Program ended on ', date
3295 end program test_fdate
3301 @section @code{FLOAT} --- Convert integer to default real
3302 @findex @code{FLOAT} intrinsic
3303 @cindex conversion function (float)
3306 @item @emph{Description}:
3307 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3309 @item @emph{Standard}:
3315 @item @emph{Syntax}:
3318 @item @emph{Arguments}:
3319 @multitable @columnfractions .15 .80
3320 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3323 @item @emph{Return value}:
3324 The return value is of type default @code{REAL}
3326 @item @emph{Example}:
3330 if (float(i) /= 1.) call abort
3331 end program test_float
3334 @item @emph{See also}:
3335 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3341 @section @code{FGET} --- Read a single character in stream mode from stdin
3342 @findex @code{FGET} intrinsic
3343 @cindex file operations
3344 @cindex stream operations
3347 @item @emph{Description}:
3348 Read a single character in stream mode from stdin by bypassing normal
3349 formatted output. Stream I/O should not be mixed with normal record-oriented
3350 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3352 This intrinsic routine is provided for backwards compatibility with
3353 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3354 Programmers should consider the use of new stream IO feature in new code
3355 for future portability. See also @ref{Fortran 2003 status}.
3357 @item @emph{Standard}:
3361 Non-elemental subroutine
3363 @item @emph{Syntax}:
3364 @code{CALL fget(C[,STATUS])}
3366 @item @emph{Arguments}:
3367 @multitable @columnfractions .15 .80
3368 @item @var{C} @tab The type shall be @code{CHARACTER}.
3369 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3370 -1 on end-of-file and a system specific positive error code otherwise.
3373 @item @emph{Example}:
3376 INTEGER, PARAMETER :: strlen = 100
3377 INTEGER :: status, i = 1
3378 CHARACTER(len=strlen) :: str = ""
3380 WRITE (*,*) 'Enter text:'
3382 CALL fget(str(i:i), status)
3383 if (status /= 0 .OR. i > strlen) exit
3386 WRITE (*,*) TRIM(str)
3390 @item @emph{See also}:
3391 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3396 @section @code{FGETC} --- Read a single character in stream mode
3397 @findex @code{FGETC} intrinsic
3398 @cindex file operations
3399 @cindex stream operations
3402 @item @emph{Description}:
3403 Read a single character in stream mode by bypassing normal formatted output.
3404 Stream I/O should not be mixed with normal record-oriented (formatted or
3405 unformatted) I/O on the same unit; the results are unpredictable.
3407 This intrinsic routine is provided for backwards compatibility with
3408 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3409 Programmers should consider the use of new stream IO feature in new code
3410 for future portability. See also @ref{Fortran 2003 status}.
3412 @item @emph{Standard}:
3416 Non-elemental subroutine
3418 @item @emph{Syntax}:
3419 @code{CALL fgetc(UNIT,C[,STATUS])}
3421 @item @emph{Arguments}:
3422 @multitable @columnfractions .15 .80
3423 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3424 @item @var{C} @tab The type shall be @code{CHARACTER}.
3425 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3426 -1 on end-of-file and a system specific positive error code otherwise.
3429 @item @emph{Example}:
3432 INTEGER :: fd = 42, status
3435 OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3437 CALL fgetc(fd, c, status)
3438 IF (status /= 0) EXIT
3445 @item @emph{See also}:
3446 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3452 @section @code{FLOOR} --- Integer floor function
3453 @findex @code{FLOOR} intrinsic
3457 @item @emph{Description}:
3458 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3460 @item @emph{Standard}:
3466 @item @emph{Syntax}:
3467 @code{I = FLOOR(X[,KIND])}
3469 @item @emph{Arguments}:
3470 @multitable @columnfractions .15 .80
3471 @item @var{X} @tab The type shall be @code{REAL(*)}.
3472 @item @var{KIND} @tab Optional scaler integer initialization expression.
3475 @item @emph{Return value}:
3476 The return value is of type @code{INTEGER(KIND)}
3478 @item @emph{Example}:
3483 print *, floor(x) ! returns 63
3484 print *, floor(y) ! returns -64
3485 end program test_floor
3488 @item @emph{See also}:
3489 @ref{CEILING}, @ref{NINT}
3496 @section @code{FLUSH} --- Flush I/O unit(s)
3497 @findex @code{FLUSH}
3501 @item @emph{Description}:
3502 Flushes Fortran unit(s) currently open for output. Without the optional
3503 argument, all units are flushed, otherwise just the unit specified.
3505 @item @emph{Standard}:
3509 non-elemental subroutine
3511 @item @emph{Syntax}:
3512 @code{CALL FLUSH(UNIT)}
3514 @item @emph{Arguments}:
3515 @multitable @columnfractions .15 .80
3516 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3520 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3521 statement that should be preferred over the @code{FLUSH} intrinsic.
3528 @section @code{FNUM} --- File number function
3529 @findex @code{FNUM} intrinsic
3533 @item @emph{Description}:
3534 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3535 open Fortran I/O unit @code{UNIT}.
3537 @item @emph{Standard}:
3541 non-elemental function
3543 @item @emph{Syntax}:
3544 @code{I = FNUM(UNIT)}
3546 @item @emph{Arguments}:
3547 @multitable @columnfractions .15 .80
3548 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3551 @item @emph{Return value}:
3552 The return value is of type @code{INTEGER}
3554 @item @emph{Example}:
3558 open (unit=10, status = "scratch")
3562 end program test_fnum
3569 @section @code{FPUT} --- Write a single character in stream mode to stdout
3570 @findex @code{FPUT} intrinsic
3571 @cindex file operations
3572 @cindex stream operations
3575 @item @emph{Description}:
3576 Write a single character in stream mode to stdout by bypassing normal
3577 formatted output. Stream I/O should not be mixed with normal record-oriented
3578 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3580 This intrinsic routine is provided for backwards compatibility with
3581 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3582 Programmers should consider the use of new stream IO feature in new code
3583 for future portability. See also @ref{Fortran 2003 status}.
3585 @item @emph{Standard}:
3589 Non-elemental subroutine
3591 @item @emph{Syntax}:
3592 @code{CALL fput(C[,STATUS])}
3594 @item @emph{Arguments}:
3595 @multitable @columnfractions .15 .80
3596 @item @var{C} @tab The type shall be @code{CHARACTER}.
3597 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3598 -1 on end-of-file and a system specific positive error code otherwise.
3601 @item @emph{Example}:
3604 CHARACTER(len=*) :: str = "gfortran"
3606 DO i = 1, len_trim(str)
3612 @item @emph{See also}:
3613 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3619 @section @code{FPUTC} --- Write a single character in stream mode
3620 @findex @code{FPUTC} intrinsic
3621 @cindex file operations
3622 @cindex stream operations
3625 @item @emph{Description}:
3626 Write a single character in stream mode by bypassing normal formatted
3627 output. Stream I/O should not be mixed with normal record-oriented
3628 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3630 This intrinsic routine is provided for backwards compatibility with
3631 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3632 Programmers should consider the use of new stream IO feature in new code
3633 for future portability. See also @ref{Fortran 2003 status}.
3635 @item @emph{Standard}:
3639 Non-elemental subroutine
3641 @item @emph{Syntax}:
3642 @code{CALL fputc(UNIT,C[,STATUS])}
3644 @item @emph{Arguments}:
3645 @multitable @columnfractions .15 .80
3646 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3647 @item @var{C} @tab The type shall be @code{CHARACTER}.
3648 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3649 -1 on end-of-file and a system specific positive error code otherwise.
3652 @item @emph{Example}:
3655 CHARACTER(len=*) :: str = "gfortran"
3656 INTEGER :: fd = 42, i
3658 OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3659 DO i = 1, len_trim(str)
3660 CALL fputc(fd, str(i:i))
3666 @item @emph{See also}:
3667 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3673 @section @code{FRACTION} --- Fractional part of the model representation
3674 @findex @code{FRACTION} intrinsic
3675 @cindex fractional part
3678 @item @emph{Description}:
3679 @code{FRACTION(X)} returns the fractional part of the model
3680 representation of @code{X}.
3682 @item @emph{Standard}:
3688 @item @emph{Syntax}:
3689 @code{Y = FRACTION(X)}
3691 @item @emph{Arguments}:
3692 @multitable @columnfractions .15 .80
3693 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3696 @item @emph{Return value}:
3697 The return value is of the same type and kind as the argument.
3698 The fractional part of the model representation of @code{X} is returned;
3699 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3701 @item @emph{Example}:
3703 program test_fraction
3706 print *, fraction(x), x * radix(x)**(-exponent(x))
3707 end program test_fraction
3715 @section @code{FREE} --- Frees memory
3716 @findex @code{FREE} intrinsic
3720 @item @emph{Description}:
3721 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3722 intrinsic is an extension intended to be used with Cray pointers, and is
3723 provided in GNU Fortran to allow user to compile legacy code. For
3724 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3727 @item @emph{Standard}:
3733 @item @emph{Syntax}:
3736 @item @emph{Arguments}:
3737 @multitable @columnfractions .15 .80
3738 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3739 location of the memory that should be de-allocated.
3742 @item @emph{Return value}:
3745 @item @emph{Example}:
3746 See @code{MALLOC} for an example.
3748 @item @emph{See also}:
3756 @section @code{FSTAT} --- Get file status
3757 @findex @code{FSTAT} intrinsic
3758 @cindex file system operations
3761 @item @emph{Description}:
3762 @code{FSTAT} is identical to @ref{STAT}, except that information about an
3763 already opened file is obtained.
3765 The elements in @code{BUFF} are the same as described by @ref{STAT}.
3767 @item @emph{Standard}:
3771 Non-elemental subroutine
3773 @item @emph{Syntax}:
3774 @code{CALL fstat(UNIT,BUFF[,STATUS])}
3776 @item @emph{Arguments}:
3777 @multitable @columnfractions .15 .80
3778 @item @var{UNIT} @tab An open I/O unit number of type @code{INTEGER}.
3779 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3780 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
3781 on success and a system specific error code otherwise.
3784 @item @emph{Example}:
3785 See @ref{STAT} for an example.
3787 @item @emph{See also}:
3788 To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
3794 @section @code{FSEEK} --- Low level file positioning subroutine
3795 @findex @code{FSEEK}
3796 @cindex file system functions
3798 Not yet implemented in GNU Fortran.
3801 @item @emph{Description}:
3803 @item @emph{Standard}:
3809 @item @emph{Syntax}:
3810 @item @emph{Arguments}:
3811 @item @emph{Return value}:
3812 @item @emph{Example}:
3813 @item @emph{Specific names}:
3814 @item @emph{See also}:
3815 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3822 @section @code{FTELL} --- Current stream position
3823 @findex @code{FTELL} intrinsic
3824 @cindex undocumented intrinsic
3826 Intrinsic implemented, documentation pending.
3829 @item @emph{Description}:
3830 @item @emph{Standard}:
3834 @item @emph{Syntax}:
3835 @item @emph{Arguments}:
3836 @item @emph{Return value}:
3837 @item @emph{Example}:
3839 @item @emph{See also}:
3846 @section @code{GETARG} --- Get command line arguments
3847 @findex @code{GETARG} intrinsic
3848 @cindex command line arguments
3852 @item @emph{Description}:
3853 Retrieve the @var{N}th argument that was passed on the
3854 command line when the containing program was invoked.
3856 This intrinsic routine is provided for backwards compatibility with
3857 GNU Fortran 77. In new code, programmers should consider the use of
3858 the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003
3861 @item @emph{Standard}:
3867 @item @emph{Syntax}:
3868 @code{CALL GETARG(N,ARG)}
3870 @item @emph{Arguments}:
3871 @multitable @columnfractions .15 .80
3872 @item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3873 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
3876 @item @emph{Return value}:
3877 After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th
3878 command line argument. If @var{ARG} can not hold the argument, it is
3879 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3880 arguments specified at the command line, @var{ARG} will be filled with blanks.
3881 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3882 that support this feature).
3884 @item @emph{Example}:
3888 CHARACTER(len=32) :: arg
3897 @item @emph{See also}:
3898 GNU Fortran 77 compability function: @ref{IARGC}
3900 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
3906 @section @code{GET_COMMAND} --- Get the entire command line
3907 @findex @code{GET_COMMAND} intrinsic
3908 @cindex command line arguments
3912 @item @emph{Description}:
3913 Retrieve the entire command line that was used to invoke the program.
3915 @item @emph{Standard}:
3921 @item @emph{Syntax}:
3922 @code{CALL GET_COMMAND(CMD)}
3924 @item @emph{Arguments}:
3925 @multitable @columnfractions .15 .80
3926 @item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}.
3929 @item @emph{Return value}:
3930 Stores the entire command line that was used to invoke the program in @var{ARG}.
3931 If @var{ARG} is not large enough, the command will be truncated.
3933 @item @emph{Example}:
3935 PROGRAM test_get_command
3936 CHARACTER(len=255) :: cmd
3937 CALL get_command(cmd)
3938 WRITE (*,*) TRIM(cmd)
3942 @item @emph{See also}:
3943 @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
3948 @node GET_COMMAND_ARGUMENT
3949 @section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
3950 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
3951 @cindex command line arguments
3955 @item @emph{Description}:
3956 Retrieve the @var{N}th argument that was passed on the
3957 command line when the containing program was invoked.
3959 @item @emph{Standard}:
3965 @item @emph{Syntax}:
3966 @code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
3968 @item @emph{Arguments}:
3969 @multitable @columnfractions .15 .80
3970 @item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3971 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
3974 @item @emph{Return value}:
3975 After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the
3976 @var{N}th command line argument. If @var{ARG} can not hold the argument, it is
3977 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3978 arguments specified at the command line, @var{ARG} will be filled with blanks.
3979 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3980 that support this feature).
3982 @item @emph{Example}:
3984 PROGRAM test_get_command_argument
3986 CHARACTER(len=32) :: arg
3990 CALL get_command_argument(i, arg)
3991 IF (LEN_TRIM(arg) == 0) EXIT
3993 WRITE (*,*) TRIM(arg)
3999 @item @emph{See also}:
4000 @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
4006 @section @code{GETCWD} --- Get current working directory
4007 @findex @code{GETCWD} intrinsic
4008 @cindex file system functions
4011 @item @emph{Description}:
4012 Get current working directory.
4014 @item @emph{Standard}:
4018 Non-elemental subroutine.
4020 @item @emph{Syntax}:
4021 @code{CALL getcwd(CWD[,STATUS])}
4023 @item @emph{Arguments}:
4024 @multitable @columnfractions .15 .80
4025 @item @var{CWD} @tab The type shall be @code{CHARACTER(*)}.
4026 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
4027 a system specific and non-zero error code otherwise.
4030 @item @emph{Example}:
4033 CHARACTER(len=255) :: cwd
4035 WRITE(*,*) TRIM(cwd)
4039 @item @emph{See also}:
4046 @section @code{GETENV} --- Get an environmental variable
4047 @findex @code{GETENV} intrinsic
4048 @cindex environment variable
4051 @item @emph{Description}:
4052 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4054 This intrinsic routine is provided for backwards compatibility with
4055 GNU Fortran 77. In new code, programmers should consider the use of
4056 the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
4059 @item @emph{Standard}:
4065 @item @emph{Syntax}:
4066 @code{CALL GETENV(ENVVAR,VALUE)}
4068 @item @emph{Arguments}:
4069 @multitable @columnfractions .15 .80
4070 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4071 @item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4074 @item @emph{Return value}:
4075 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4076 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4077 is not set, @var{VALUE} will be filled with blanks.
4079 @item @emph{Example}:
4082 CHARACTER(len=255) :: homedir
4083 CALL getenv("HOME", homedir)
4084 WRITE (*,*) TRIM(homedir)
4088 @item @emph{See also}:
4089 @ref{GET_ENVIRONMENT_VARIABLE}
4094 @node GET_ENVIRONMENT_VARIABLE
4095 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4096 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
4097 @cindex environment variable
4100 @item @emph{Description}:
4101 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4103 @item @emph{Standard}:
4109 @item @emph{Syntax}:
4110 @code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
4112 @item @emph{Arguments}:
4113 @multitable @columnfractions .15 .80
4114 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4115 @item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4118 @item @emph{Return value}:
4119 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4120 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4121 is not set, @var{VALUE} will be filled with blanks.
4123 @item @emph{Example}:
4126 CHARACTER(len=255) :: homedir
4127 CALL get_environment_variable("HOME", homedir)
4128 WRITE (*,*) TRIM(homedir)
4136 @section @code{GETGID} --- Group ID function
4137 @findex @code{GETGID} intrinsic
4141 @item @emph{Description}:
4142 Returns the numerical group ID of the current process.
4144 @item @emph{Standard}:
4150 @item @emph{Syntax}:
4153 @item @emph{Return value}:
4154 The return value of @code{GETGID} is an @code{INTEGER} of the default
4158 @item @emph{Example}:
4159 See @code{GETPID} for an example.
4161 @item @emph{See also}:
4168 @section @code{GETLOG} --- Get login name
4169 @findex @code{GETLOG} intrinsic
4170 @cindex undocumented intrinsic
4172 Intrinsic implemented, documentation pending.
4175 @item @emph{Description}:
4176 @item @emph{Standard}:
4182 @item @emph{Syntax}:
4183 @item @emph{Arguments}:
4184 @item @emph{Return value}:
4185 @item @emph{Example}:
4186 @item @emph{Specific names}:
4187 @item @emph{See also}:
4194 @section @code{GETPID} --- Process ID function
4195 @findex @code{GETPID} intrinsic
4199 @item @emph{Description}:
4200 Returns the numerical process identifier of the current process.
4202 @item @emph{Standard}:
4208 @item @emph{Syntax}:
4211 @item @emph{Return value}:
4212 The return value of @code{GETPID} is an @code{INTEGER} of the default
4216 @item @emph{Example}:
4219 print *, "The current process ID is ", getpid()
4220 print *, "Your numerical user ID is ", getuid()
4221 print *, "Your numerical group ID is ", getgid()
4230 @section @code{GETUID} --- User ID function
4231 @findex @code{GETUID} intrinsic
4235 @item @emph{Description}:
4236 Returns the numerical user ID of the current process.
4238 @item @emph{Standard}:
4244 @item @emph{Syntax}:
4247 @item @emph{Return value}:
4248 The return value of @code{GETUID} is an @code{INTEGER} of the default
4252 @item @emph{Example}:
4253 See @code{GETPID} for an example.
4255 @item @emph{See also}:
4262 @section @code{GMTIME} --- Convert time to GMT info
4263 @findex @code{GMTIME}
4264 @cindex time function
4266 Not yet implemented in GNU Fortran.
4269 @item @emph{Description}:
4271 @item @emph{Standard}:
4277 @item @emph{Syntax}:
4278 @item @emph{Arguments}:
4279 @item @emph{Return value}:
4280 @item @emph{Example}:
4281 @item @emph{Specific names}:
4282 @item @emph{See also}:
4289 @section @code{HOSTNM} --- Get system host name
4290 @findex @code{HOSTNM} intrinsic
4291 @cindex undocumented intrinsic
4293 Intrinsic implemented, documentation pending.
4296 @item @emph{Description}:
4297 @item @emph{Standard}:
4301 @item @emph{Syntax}:
4302 @item @emph{Arguments}:
4303 @item @emph{Return value}:
4304 @item @emph{Example}:
4305 @item @emph{Specific names}:
4306 @item @emph{See also}:
4312 @section @code{HUGE} --- Largest number of a kind
4313 @findex @code{HUGE} intrinsic
4317 @item @emph{Description}:
4318 @code{HUGE(X)} returns the largest number that is not an infinity in
4319 the model of the type of @code{X}.
4321 @item @emph{Standard}:
4327 @item @emph{Syntax}:
4330 @item @emph{Arguments}:
4331 @multitable @columnfractions .15 .80
4332 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4335 @item @emph{Return value}:
4336 The return value is of the same type and kind as @var{X}
4338 @item @emph{Example}:
4340 program test_huge_tiny
4341 print *, huge(0), huge(0.0), huge(0.0d0)
4342 print *, tiny(0.0), tiny(0.0d0)
4343 end program test_huge_tiny
4350 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
4351 @findex @code{IACHAR} intrinsic
4352 @cindex @acronym{ASCII} collating sequence
4353 @cindex conversion function (character)
4356 @item @emph{Description}:
4357 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4358 in the first character position of @code{C}.
4360 @item @emph{Standard}:
4366 @item @emph{Syntax}:
4367 @code{I = IACHAR(C)}
4369 @item @emph{Arguments}:
4370 @multitable @columnfractions .15 .80
4371 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4374 @item @emph{Return value}:
4375 The return value is of type @code{INTEGER} and of the default integer
4378 @item @emph{Example}:
4383 end program test_iachar
4386 @item @emph{See also}:
4387 @ref{CHAR},@ref{ICHAR}
4393 @section @code{IAND} --- Bitwise logical and
4394 @findex @code{IAND} intrinsic
4395 @cindex bit operations
4398 @item @emph{Description}:
4399 Bitwise logical @code{AND}.
4401 @item @emph{Standard}:
4407 @item @emph{Syntax}:
4408 @code{RESULT = IAND(X, Y)}
4410 @item @emph{Arguments}:
4411 @multitable @columnfractions .15 .80
4412 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
4413 @item @var{Y} @tab The type shall be @code{INTEGER(*)}.
4416 @item @emph{Return value}:
4417 The return type is @code{INTEGER(*)} after cross-promotion of the arguments.
4419 @item @emph{Example}:
4423 DATA a / Z'F' /, b / Z'3' /
4424 WRITE (*,*) IAND(a, b)
4428 @item @emph{See also}:
4429 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4435 @section @code{IARGC} --- Get the number of command line arguments
4436 @findex @code{IARGC} intrinsic
4437 @cindex command line arguments
4441 @item @emph{Description}:
4442 @code{IARGC()} returns the number of arguments passed on the
4443 command line when the containing program was invoked.
4445 This intrinsic routine is provided for backwards compatibility with
4446 GNU Fortran 77. In new code, programmers should consider the use of
4447 the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003
4450 @item @emph{Standard}:
4454 Non-elemental Function
4456 @item @emph{Syntax}:
4459 @item @emph{Arguments}:
4462 @item @emph{Return value}:
4463 The number of command line arguments, type @code{INTEGER(4)}.
4465 @item @emph{Example}:
4468 @item @emph{See also}:
4469 GNU Fortran 77 compability subroutine: @ref{GETARG}
4471 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4477 @section @code{IBCLR} --- Clear bit
4478 @findex @code{IBCLR} intrinsic
4479 @cindex bit operations
4481 Intrinsic implemented, documentation pending.
4484 @item @emph{Description}:
4485 @item @emph{Standard}:
4491 @item @emph{Syntax}:
4492 @item @emph{Arguments}:
4493 @item @emph{Return value}:
4494 @item @emph{Example}:
4495 @item @emph{Specific names}:
4497 @item @emph{See also}:
4498 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4505 @section @code{IBITS} --- Bit extraction
4506 @findex @code{IBITS} intrinsic
4507 @cindex bit operations
4509 Intrinsic implemented, documentation pending.
4512 @item @emph{Description}:
4513 @item @emph{Standard}:
4519 @item @emph{Syntax}:
4520 @item @emph{Arguments}:
4521 @item @emph{Return value}:
4522 @item @emph{Example}:
4523 @item @emph{Specific names}:
4524 @item @emph{See also}:
4525 @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4533 @section @code{IBSET} --- Set bit
4534 @findex @code{IBSET} intrinsic
4535 @cindex bit operations
4537 Intrinsic implemented, documentation pending.
4540 @item @emph{Description}:
4541 @item @emph{Standard}:
4547 @item @emph{Syntax}:
4548 @item @emph{Arguments}:
4549 @item @emph{Return value}:
4550 @item @emph{Example}:
4551 @item @emph{Specific names}:
4553 @item @emph{See also}:
4554 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4561 @section @code{ICHAR} --- Character-to-integer conversion function
4562 @findex @code{ICHAR} intrinsic
4563 @cindex conversion function (character)
4566 @item @emph{Description}:
4567 @code{ICHAR(C)} returns the code for the character in the first character
4568 position of @code{C} in the system's native character set.
4569 The correspondence between characters and their codes is not necessarily
4570 the same across different GNU Fortran implementations.
4572 @item @emph{Standard}:
4578 @item @emph{Syntax}:
4581 @item @emph{Arguments}:
4582 @multitable @columnfractions .15 .80
4583 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4586 @item @emph{Return value}:
4587 The return value is of type @code{INTEGER} and of the default integer
4590 @item @emph{Example}:
4595 end program test_ichar
4599 No intrinsic exists to convert a printable character string to a numerical
4600 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4601 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4604 Instead, you can use internal-file I/O to do this kind of conversion. For
4609 character(len=10) string
4612 read (string,'(I10)') value
4614 end program read_val
4619 @section @code{IDATE} --- Get current local time subroutine (day/month/year)
4620 @findex @code{IDATE} intrinsic
4623 @item @emph{Description}:
4624 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4625 current local time. The day (in the range 1-31), month (in the range 1-12),
4626 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively.
4627 The year has four significant digits.
4629 @item @emph{Standard}:
4635 @item @emph{Syntax}:
4636 @code{CALL IDATE(TARRAY)}
4638 @item @emph{Arguments}:
4639 @multitable @columnfractions .15 .80
4640 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4641 the kind shall be the default integer kind.
4644 @item @emph{Return value}:
4647 @item @emph{Example}:
4650 integer, dimension(3) :: tarray
4655 end program test_idate
4662 @section @code{IEOR} --- Bitwise logical exclusive or
4663 @findex @code{IEOR} intrinsic
4664 @cindex bit operations
4666 Intrinsic implemented, documentation pending.
4669 @item @emph{Description}:
4670 @item @emph{Standard}:
4676 @item @emph{Syntax}:
4677 @item @emph{Arguments}:
4678 @item @emph{Return value}:
4679 @item @emph{Example}:
4680 @item @emph{Specific names}:
4682 @item @emph{See also}:
4683 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4690 @section @code{IERRNO} --- Get the last system error number
4691 @findex @code{IERRNO} intrinsic
4692 @cindex undocumented intrinsic
4694 Intrinsic implemented, documentation pending.
4697 @item @emph{Description}:
4698 @item @emph{Standard}:
4702 @item @emph{Syntax}:
4703 @item @emph{Arguments}:
4704 @item @emph{Return value}:
4705 @item @emph{Example}:
4707 @item @emph{See also}:
4715 @section @code{INDEX} --- Position of a substring within a string
4716 @findex @code{INDEX} intrinsic
4717 @cindex undocumented intrinsic
4719 Intrinsic implemented, documentation pending.
4722 @item @emph{Description}:
4723 @item @emph{Standard}:
4729 @item @emph{Syntax}:
4730 @item @emph{Arguments}:
4731 @item @emph{Return value}:
4732 @item @emph{Example}:
4733 @item @emph{Specific names}:
4734 @item @emph{See also}:
4741 @section @code{INT} --- Convert to integer type
4742 @findex @code{INT} intrinsic
4743 @findex @code{IFIX} intrinsic
4744 @findex @code{IDINT} intrinsic
4745 @cindex conversion function (integer)
4748 @item @emph{Description}:
4749 Convert to integer type
4751 @item @emph{Standard}:
4757 @item @emph{Syntax}:
4758 @multitable @columnfractions .30 .80
4759 @item @code{X = INT(X)}
4760 @item @code{X = INT(X, KIND)}
4763 @item @emph{Arguments}:
4764 @multitable @columnfractions .15 .80
4765 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or @code{COMPLEX(*)}
4766 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
4769 @item @emph{Return value}:
4770 These functions return a @code{INTEGER(*)} variable or array under
4771 the following rules:
4775 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X}
4777 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}.
4778 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed
4779 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4781 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4784 @item @emph{Example}:
4788 complex :: z = (-3.7, 1.0)
4790 print *, int(z), int(z,8)
4794 @item @emph{Specific names}:
4795 @multitable @columnfractions .20 .20 .20 .40
4796 @item Name @tab Argument @tab Return type @tab Standard
4797 @item @code{IFIX(X)} @tab @code{REAL(4) X} @tab @code{INTEGER} @tab F77 and later
4798 @item @code{IDINT(X)} @tab @code{REAL(8) X} @tab @code{INTEGER} @tab F77 and later
4801 @comment @item @emph{See also}:
4808 @section @code{IOR} --- Bitwise logical or
4809 @findex @code{IOR} intrinsic
4810 @cindex bit operations
4812 Intrinsic implemented, documentation pending.
4815 @item @emph{Description}:
4816 @item @emph{Standard}:
4822 @item @emph{Syntax}:
4823 @item @emph{Arguments}:
4824 @item @emph{Return value}:
4825 @item @emph{Example}:
4826 @item @emph{Specific names}:
4828 @item @emph{See also}:
4829 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4836 @section @code{IRAND} --- Integer pseudo-random number
4837 @findex @code{IRAND} intrinsic
4838 @cindex random number
4841 @item @emph{Description}:
4842 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
4843 distribution between 0 and a system-dependent limit (which is in most
4844 cases 2147483647). If @var{FLAG} is 0, the next number
4845 in the current sequence is returned; if @var{FLAG} is 1, the generator
4846 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
4847 it is used as a new seed with @code{SRAND}.
4849 @item @emph{Standard}:
4853 non-elemental function
4855 @item @emph{Syntax}:
4856 @code{I = IRAND(FLAG)}
4858 @item @emph{Arguments}:
4859 @multitable @columnfractions .15 .80
4860 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
4863 @item @emph{Return value}:
4864 The return value is of @code{INTEGER(kind=4)} type.
4866 @item @emph{Example}:
4869 integer,parameter :: seed = 86456
4872 print *, irand(), irand(), irand(), irand()
4873 print *, irand(seed), irand(), irand(), irand()
4874 end program test_irand
4882 @section @code{ISHFT} --- Shift bits
4883 @findex @code{ISHFT} intrinsic
4884 @cindex bit manipulation
4886 Intrinsic implemented, documentation pending.
4889 @item @emph{Description}:
4890 @item @emph{Standard}:
4896 @item @emph{Syntax}:
4897 @item @emph{Arguments}:
4898 @item @emph{Return value}:
4899 @item @emph{Example}:
4900 @item @emph{Specific names}:
4902 @item @emph{See also}:
4910 @section @code{ISHFTC} --- Shift bits circularly
4911 @findex @code{ISHFTC} intrinsic
4912 @cindex bit manipulation
4914 Intrinsic implemented, documentation pending.
4917 @item @emph{Description}:
4918 @item @emph{Standard}:
4924 @item @emph{Syntax}:
4925 @item @emph{Arguments}:
4926 @item @emph{Return value}:
4927 @item @emph{Example}:
4928 @item @emph{Specific names}:
4930 @item @emph{See also}:
4937 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
4938 @findex @code{ITIME} intrinsic
4941 @item @emph{Description}:
4942 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4943 current local time. The hour (in the range 1-24), minute (in the range 1-60),
4944 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY},
4947 @item @emph{Standard}:
4953 @item @emph{Syntax}:
4954 @code{CALL ITIME(TARRAY)}
4956 @item @emph{Arguments}:
4957 @multitable @columnfractions .15 .80
4958 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
4959 and the kind shall be the default integer kind.
4962 @item @emph{Return value}:
4966 @item @emph{Example}:
4969 integer, dimension(3) :: tarray
4974 end program test_itime
4981 @section @code{KILL} --- Send a signal to a process
4982 @findex @code{KILL} intrinsic
4983 @cindex undocumented intrinsic
4985 Intrinsic implemented, documentation pending.
4988 @item @emph{Description}:
4989 @item @emph{Standard}:
4995 @item @emph{Syntax}:
4996 @item @emph{Arguments}:
4997 @item @emph{Return value}:
4998 @item @emph{Example}:
4999 @item @emph{Specific names}:
5001 @item @emph{See also}:
5002 @ref{ABORT}, @ref{EXIT}
5008 @section @code{KIND} --- Kind of an entity
5009 @findex @code{KIND} intrinsic
5012 @item @emph{Description}:
5013 @code{KIND(X)} returns the kind value of the entity @var{X}.
5015 @item @emph{Standard}:
5021 @item @emph{Syntax}:
5024 @item @emph{Arguments}:
5025 @multitable @columnfractions .15 .80
5026 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5027 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5030 @item @emph{Return value}:
5031 The return value is a scalar of type @code{INTEGER} and of the default
5034 @item @emph{Example}:
5037 integer,parameter :: kc = kind(' ')
5038 integer,parameter :: kl = kind(.true.)
5040 print *, "The default character kind is ", kc
5041 print *, "The default logical kind is ", kl
5042 end program test_kind
5050 @section @code{LBOUND} --- Lower dimension bounds of an array
5051 @findex @code{LBOUND} intrinsic
5052 @cindex undocumented intrinsic
5054 Intrinsic implemented, documentation pending.
5057 @item @emph{Description}:
5058 @item @emph{Standard}:
5064 @item @emph{Syntax}:
5065 @item @emph{Arguments}:
5066 @item @emph{Return value}:
5067 @item @emph{Example}:
5068 @item @emph{See also}:
5076 @section @code{LEN} --- Length of a character entity
5077 @findex @code{LEN} intrinsic
5078 @cindex undocumented intrinsic
5080 Intrinsic implemented, documentation pending.
5083 @item @emph{Description}:
5084 @item @emph{Standard}:
5090 @item @emph{Syntax}:
5091 @item @emph{Arguments}:
5092 @item @emph{Return value}:
5093 @item @emph{Example}:
5094 @item @emph{Specific names}:
5096 @item @emph{See also}:
5097 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5104 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
5105 @findex @code{LEN_TRIM} intrinsic
5106 @cindex undocumented intrinsic
5108 Intrinsic implemented, documentation pending.
5111 @item @emph{Description}:
5112 @item @emph{Standard}:
5118 @item @emph{Syntax}:
5119 @item @emph{Arguments}:
5120 @item @emph{Return value}:
5121 @item @emph{Example}:
5123 @item @emph{See also}:
5124 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5131 @section @code{LGE} --- Lexical greater than or equal
5132 @findex @code{LGE} intrinsic
5133 @cindex comparison (lexical)
5135 Intrinsic implemented, documentation pending.
5138 @item @emph{Description}:
5139 @item @emph{Standard}:
5145 @item @emph{Syntax}:
5146 @item @emph{Arguments}:
5147 @item @emph{Return value}:
5148 @item @emph{Example}:
5150 @item @emph{See also}:
5151 @ref{LGT}, @ref{LLE}, @ref{LLT}
5158 @section @code{LGT} --- Lexical greater than
5159 @findex @code{LGT} intrinsic
5160 @cindex comparison (lexical)
5162 Intrinsic implemented, documentation pending.
5165 @item @emph{Description}:
5166 @item @emph{Standard}:
5172 @item @emph{Syntax}:
5173 @item @emph{Arguments}:
5174 @item @emph{Return value}:
5175 @item @emph{Example}:
5177 @item @emph{See also}:
5178 @ref{LGE}, @ref{LLE}, @ref{LLT}
5185 @section @code{LINK} --- Create a hard link
5186 @findex @code{LINK} intrinsic
5187 @cindex file system operations
5189 Intrinsic implemented, documentation pending.
5192 @item @emph{Description}:
5193 @item @emph{Standard}:
5199 @item @emph{Syntax}:
5200 @item @emph{Arguments}:
5201 @item @emph{Return value}:
5202 @item @emph{Example}:
5203 @item @emph{Specific names}:
5205 @item @emph{See also}:
5213 @section @code{LLE} --- Lexical less than or equal
5214 @findex @code{LLE} intrinsic
5215 @cindex comparison (lexical)
5217 Intrinsic implemented, documentation pending.
5220 @item @emph{Description}:
5221 @item @emph{Standard}:
5227 @item @emph{Syntax}:
5228 @item @emph{Arguments}:
5229 @item @emph{Return value}:
5230 @item @emph{Example}:
5232 @item @emph{See also}:
5233 @ref{LGE}, @ref{LGT}, @ref{LLT}
5240 @section @code{LLT} --- Lexical less than
5241 @findex @code{LLT} intrinsic
5242 @cindex comparison (lexical)
5244 Intrinsic implemented, documentation pending.
5247 @item @emph{Description}:
5248 @item @emph{Standard}:
5254 @item @emph{Syntax}:
5255 @item @emph{Arguments}:
5256 @item @emph{Return value}:
5257 @item @emph{Example}:
5259 @item @emph{See also}:
5260 @ref{LGE}, @ref{LGT}, @ref{LLE}
5267 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5268 @findex @code{LNBLNK} intrinsic
5269 @cindex undocumented intrinsic
5271 Intrinsic implemented, documentation pending.
5274 @item @emph{Description}:
5275 @item @emph{Standard}:
5279 @item @emph{Syntax}:
5280 @item @emph{Arguments}:
5281 @item @emph{Return value}:
5282 @item @emph{Example}:
5283 @item @emph{Specific names}:
5285 @item @emph{See also}:
5293 @section @code{LOC} --- Returns the address of a variable
5294 @findex @code{LOC} intrinsic
5298 @item @emph{Description}:
5299 @code{LOC(X)} returns the address of @var{X} as an integer.
5301 @item @emph{Standard}:
5307 @item @emph{Syntax}:
5310 @item @emph{Arguments}:
5311 @multitable @columnfractions .15 .80
5312 @item @var{X} @tab Variable of any type.
5315 @item @emph{Return value}:
5316 The return value is of type @code{INTEGER(n)}, where @code{n} is the
5317 size (in bytes) of a memory address on the target machine.
5319 @item @emph{Example}:
5326 end program test_loc
5331 @section @code{LOG} --- Logarithm function
5332 @findex @code{LOG} intrinsic
5333 @findex @code{ALOG} intrinsic
5334 @findex @code{DLOG} intrinsic
5335 @findex @code{CLOG} intrinsic
5336 @findex @code{ZLOG} intrinsic
5337 @findex @code{CDLOG} intrinsic
5341 @item @emph{Description}:
5342 @code{LOG(X)} computes the logarithm of @var{X}.
5344 @item @emph{Standard}:
5350 @item @emph{Syntax}:
5353 @item @emph{Arguments}:
5354 @multitable @columnfractions .15 .80
5355 @item @var{X} @tab The type shall be @code{REAL(*)} or
5359 @item @emph{Return value}:
5360 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5361 The kind type parameter is the same as @var{X}.
5363 @item @emph{Example}:
5366 real(8) :: x = 1.0_8
5367 complex :: z = (1.0, 2.0)
5370 end program test_log
5373 @item @emph{Specific names}:
5374 @multitable @columnfractions .20 .20 .20 .40
5375 @item Name @tab Argument @tab Return type @tab Standard
5376 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
5377 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
5378 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
5379 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5380 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5387 @section @code{LOG10} --- Base 10 logarithm function
5388 @findex @code{LOG10} intrinsic
5389 @findex @code{ALOG10} intrinsic
5390 @findex @code{DLOG10} intrinsic
5394 @item @emph{Description}:
5395 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5397 @item @emph{Standard}:
5403 @item @emph{Syntax}:
5406 @item @emph{Arguments}:
5407 @multitable @columnfractions .15 .80
5408 @item @var{X} @tab The type shall be @code{REAL(*)} or
5412 @item @emph{Return value}:
5413 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5414 The kind type parameter is the same as @var{X}.
5416 @item @emph{Example}:
5419 real(8) :: x = 10.0_8
5421 end program test_log10
5424 @item @emph{Specific names}:
5425 @multitable @columnfractions .20 .20 .20 .40
5426 @item Name @tab Argument @tab Return type @tab Standard
5427 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F95 and later
5428 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
5434 @section @code{LOGICAL} --- Convert to logical type
5435 @findex @code{LOGICAL} intrinsic
5436 @cindex conversion function (logical)
5438 Intrinsic implemented, documentation pending.
5441 @item @emph{Description}:
5442 @item @emph{Standard}:
5448 @item @emph{Syntax}:
5449 @item @emph{Arguments}:
5450 @item @emph{Return value}:
5451 @item @emph{Example}:
5452 @item @emph{Specific names}:
5453 @item @emph{See also}:
5460 @section @code{LSHIFT} --- Left shift bits
5461 @findex @code{LSHIFT}
5462 @cindex bit manipulation
5464 Not yet implemented in GNU Fortran.
5467 @item @emph{Description}:
5469 @item @emph{Standard}:
5475 @item @emph{Syntax}:
5476 @item @emph{Arguments}:
5477 @item @emph{Return value}:
5478 @item @emph{Example}:
5479 @item @emph{Specific names}:
5480 @item @emph{See also}:
5486 @section @code{LSTAT} --- Get file status
5487 @findex @code{LSTAT} intrinsic
5488 @cindex file system operations
5491 @item @emph{Description}:
5492 @code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link,
5493 then the link itself is statted, not the file that it refers to.
5495 The elements in @code{BUFF} are the same as described by @ref{STAT}.
5497 @item @emph{Standard}:
5501 Non-elemental subroutine
5503 @item @emph{Syntax}:
5504 @code{CALL LSTAT(FILE,BUFF[,STATUS])}
5506 @item @emph{Arguments}:
5507 @multitable @columnfractions .15 .80
5508 @item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5509 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5510 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
5511 on success and a system specific error code otherwise.
5514 @item @emph{Example}:
5515 See @ref{STAT} for an example.
5517 @item @emph{See also}:
5518 To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5524 @section @code{LTIME} --- Convert time to local time info
5525 @findex @code{LTIME}
5526 @cindex time function
5528 Not yet implemented in GNU Fortran.
5531 @item @emph{Description}:
5533 @item @emph{Standard}:
5539 @item @emph{Syntax}:
5540 @item @emph{Arguments}:
5541 @item @emph{Return value}:
5542 @item @emph{Example}:
5543 @item @emph{Specific names}:
5544 @item @emph{See also}:
5551 @section @code{MALLOC} --- Allocate dynamic memory
5552 @findex @code{MALLOC} intrinsic
5556 @item @emph{Description}:
5557 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5558 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5559 is an extension intended to be used with Cray pointers, and is provided
5560 in GNU Fortran to allow the user to compile legacy code. For new code
5561 using Fortran 95 pointers, the memory allocation intrinsic is
5564 @item @emph{Standard}:
5568 non-elemental function
5570 @item @emph{Syntax}:
5571 @code{PTR = MALLOC(SIZE)}
5573 @item @emph{Arguments}:
5574 @multitable @columnfractions .15 .80
5575 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5578 @item @emph{Return value}:
5579 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5580 variables of type @code{INTEGER(K)} have the same size as
5581 C pointers (@code{sizeof(void *)}).
5583 @item @emph{Example}:
5584 The following example demonstrates the use of @code{MALLOC} and
5585 @code{FREE} with Cray pointers. This example is intended to run on
5586 32-bit systems, where the default integer kind is suitable to store
5587 pointers; on 64-bit systems, ptr_x would need to be declared as
5588 @code{integer(kind=8)}.
5597 ptr_x = malloc(20*8)
5599 x(i) = sqrt(1.0d0 / i)
5607 end program test_malloc
5610 @item @emph{See also}:
5616 @section @code{MATMUL} --- matrix multiplication
5617 @findex @code{MATMUL} intrinsic
5618 @cindex matrix operations
5620 Intrinsic implemented, documentation pending.
5623 @item @emph{Description}:
5624 @item @emph{Standard}:
5628 Transformational function
5630 @item @emph{Syntax}:
5631 @item @emph{Arguments}:
5632 @item @emph{Return value}:
5633 @item @emph{Example}:
5634 @item @emph{See also}:
5639 @section @code{MAX} --- Maximum value of an argument list
5640 @findex @code{MAX} intrinsic
5641 @cindex undocumented intrinsic
5643 Intrinsic implemented, documentation pending.
5646 @item @emph{Description}:
5647 @item @emph{Standard}:
5653 @item @emph{Syntax}:
5654 @item @emph{Arguments}:
5655 @item @emph{Return value}:
5656 @item @emph{Example}:
5658 @item @emph{Specific names}:
5659 @multitable @columnfractions .20 .20 .20 .40
5660 @item Name @tab Argument @tab Return type @tab Standard
5661 @item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5662 @item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
5663 @item @code{MAX1(X)} @tab @code{REAL(*) X} @tab @code{INT(MAX(X))} @tab F77 and later
5664 @item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5665 @item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5668 @item @emph{See also}:
5669 @ref{MAXLOC} @ref{MAXVAL}
5674 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
5675 @findex @code{MAXEXPONENT} intrinsic
5679 @item @emph{Description}:
5680 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
5683 @item @emph{Standard}:
5689 @item @emph{Syntax}:
5690 @code{I = MAXEXPONENT(X)}
5692 @item @emph{Arguments}:
5693 @multitable @columnfractions .15 .80
5694 @item @var{X} @tab shall be of type @code{REAL}.
5697 @item @emph{Return value}:
5698 The return value is of type @code{INTEGER} and of the default integer
5701 @item @emph{Example}:
5707 print *, minexponent(x), maxexponent(x)
5708 print *, minexponent(y), maxexponent(y)
5709 end program exponents
5715 @section @code{MAXLOC} --- Location of the maximum value within an array
5716 @findex @code{MAXLOC} intrinsic
5717 @cindex undocumented intrinsic
5719 Intrinsic implemented, documentation pending.
5722 @item @emph{Description}:
5723 @item @emph{Standard}:
5727 Transformational function
5729 @item @emph{Syntax}:
5730 @item @emph{Arguments}:
5731 @item @emph{Return value}:
5732 @item @emph{Example}:
5733 @item @emph{See also}:
5734 @ref{MAX}, @ref{MAXVAL}
5740 @section @code{MAXVAL} --- Maximum value of an array
5741 @findex @code{MAXVAL} intrinsic
5742 @cindex undocumented intrinsic
5744 Intrinsic implemented, documentation pending.
5747 @item @emph{Description}:
5748 @item @emph{Standard}:
5752 Transformational function
5754 @item @emph{Syntax}:
5755 @item @emph{Arguments}:
5756 @item @emph{Return value}:
5757 @item @emph{Example}:
5758 @item @emph{Specific names}:
5760 @item @emph{See also}:
5761 @ref{MAX}, @ref{MAXLOC}
5768 @section @code{MERGE} --- Merge arrays
5769 @findex @code{MERGE} intrinsic
5770 @cindex undocumented intrinsic
5772 Intrinsic implemented, documentation pending.
5775 @item @emph{Description}:
5776 @item @emph{Standard}:
5782 @item @emph{Syntax}:
5783 @item @emph{Arguments}:
5784 @item @emph{Return value}:
5785 @item @emph{Example}:
5786 @item @emph{Specific names}:
5787 @item @emph{See also}:
5792 @section @code{MIN} --- Minimum value of an argument list
5793 @findex @code{MIN} intrinsic
5794 @cindex undocumented intrinsic
5796 Intrinsic implemented, documentation pending.
5799 @item @emph{Description}:
5800 @item @emph{Standard}:
5806 @item @emph{Syntax}:
5807 @item @emph{Arguments}:
5808 @item @emph{Return value}:
5809 @item @emph{Example}:
5811 @item @emph{Specific names}:
5812 @multitable @columnfractions .20 .20 .20 .40
5813 @item Name @tab Argument @tab Return type @tab Standard
5814 @item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5815 @item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
5816 @item @code{MIN1(X)} @tab @code{REAL(*) X} @tab @code{INT(MIN(X))} @tab F77 and later
5817 @item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5818 @item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5821 @item @emph{See also}:
5822 @ref{MINLOC}, @ref{MINVAL}
5826 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
5827 @findex @code{MINEXPONENT} intrinsic
5831 @item @emph{Description}:
5832 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
5835 @item @emph{Standard}:
5841 @item @emph{Syntax}:
5842 @code{I = MINEXPONENT(X)}
5844 @item @emph{Arguments}:
5845 @multitable @columnfractions .15 .80
5846 @item @var{X} @tab shall be of type @code{REAL}.
5849 @item @emph{Return value}:
5850 The return value is of type @code{INTEGER} and of the default integer
5853 @item @emph{Example}:
5854 See @code{MAXEXPONENT} for an example.
5859 @section @code{MINLOC} --- Location of the minimum value within an array
5860 @findex @code{MINLOC} intrinsic
5861 @cindex undocumented intrinsic
5863 Intrinsic implemented, documentation pending.
5866 @item @emph{Description}:
5867 @item @emph{Standard}:
5871 Transformational function
5873 @item @emph{Syntax}:
5874 @item @emph{Arguments}:
5875 @item @emph{Return value}:
5876 @item @emph{Example}:
5878 @item @emph{See also}:
5879 @ref{MIN}, @ref{MINVAL}
5885 @section @code{MINVAL} --- Minimum value of an array
5886 @findex @code{MINVAL} intrinsic
5887 @cindex undocumented intrinsic
5889 Intrinsic implemented, documentation pending.
5892 @item @emph{Description}:
5893 @item @emph{Standard}:
5897 Transformational function
5899 @item @emph{Syntax}:
5900 @item @emph{Arguments}:
5901 @item @emph{Return value}:
5902 @item @emph{Example}:
5904 @item @emph{See also}:
5905 @ref{MIN}, @ref{MINLOC}
5912 @section @code{MOD} --- Remainder function
5913 @findex @code{MOD} intrinsic
5914 @findex @code{AMOD} intrinsic
5915 @findex @code{DMOD} intrinsic
5919 @item @emph{Description}:
5920 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
5921 calculated as @code{A - (INT(A/P) * P)}.
5923 @item @emph{Standard}:
5929 @item @emph{Syntax}:
5932 @item @emph{Arguments}:
5933 @multitable @columnfractions .15 .80
5934 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5935 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
5939 @item @emph{Return value}:
5940 The kind of the return value is the result of cross-promoting
5941 the kinds of the arguments.
5943 @item @emph{Example}:
5947 print *, mod(17.5,5.5)
5948 print *, mod(17.5d0,5.5)
5949 print *, mod(17.5,5.5d0)
5952 print *, mod(-17.5,5.5)
5953 print *, mod(-17.5d0,5.5)
5954 print *, mod(-17.5,5.5d0)
5957 print *, mod(17.5,-5.5)
5958 print *, mod(17.5d0,-5.5)
5959 print *, mod(17.5,-5.5d0)
5960 end program test_mod
5963 @item @emph{Specific names}:
5964 @multitable @columnfractions .20 .20 .20 .40
5965 @item Name @tab Arguments @tab Return type @tab Standard
5966 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
5967 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
5974 @section @code{MODULO} --- Modulo function
5975 @findex @code{MODULO} intrinsic
5979 @item @emph{Description}:
5980 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
5982 @item @emph{Standard}:
5988 @item @emph{Syntax}:
5989 @code{X = MODULO(A,P)}
5991 @item @emph{Arguments}:
5992 @multitable @columnfractions .15 .80
5993 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5994 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
5997 @item @emph{Return value}:
5998 The type and kind of the result are those of the arguments.
6000 @item If @var{A} and @var{P} are of type @code{INTEGER}:
6001 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6002 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6004 @item If @var{A} and @var{P} are of type @code{REAL}:
6005 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6007 In all cases, if @var{P} is zero the result is processor-dependent.
6009 @item @emph{Example}:
6012 print *, modulo(17,3)
6013 print *, modulo(17.5,5.5)
6015 print *, modulo(-17,3)
6016 print *, modulo(-17.5,5.5)
6018 print *, modulo(17,-3)
6019 print *, modulo(17.5,-5.5)
6020 end program test_mod
6028 @section @code{MVBITS} --- Move bits from one integer to another
6029 @findex @code{MVBITS} intrinsic
6030 @cindex bit operations
6032 Intrinsic implemented, documentation pending.
6035 @item @emph{Description}:
6036 @item @emph{Standard}:
6040 Elemental subroutine
6042 @item @emph{Syntax}:
6043 @item @emph{Arguments}:
6044 @item @emph{Return value}:
6045 @item @emph{Example}:
6046 @item @emph{See also}:
6053 @section @code{MOVE_ALLOC} --- Move allocation from one object to another
6054 @findex @code{MOVE_ALLOC} intrinsic
6058 @item @emph{Description}:
6059 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6060 @var{DEST}. @var{SRC} will become deallocated in the process.
6062 @item @emph{Standard}:
6068 @item @emph{Syntax}:
6069 @code{CALL MOVE_ALLOC(SRC, DEST)}
6071 @item @emph{Arguments}:
6072 @multitable @columnfractions .15 .80
6073 @item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be of any type and kind.
6074 @item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be of the same type, kind and rank as @var{SRC}
6077 @item @emph{Return value}:
6080 @item @emph{Example}:
6082 program test_move_alloc
6083 integer, allocatable :: a(:), b(:)
6087 call move_alloc(a, b)
6088 print *, allocated(a), allocated(b)
6090 end program test_move_alloc
6097 @section @code{NEAREST} --- Nearest representable number
6098 @findex @code{NEAREST} intrinsic
6099 @cindex processor-representable number
6102 @item @emph{Description}:
6103 @code{NEAREST(X, S)} returns the processor-representable number nearest
6104 to @code{X} in the direction indicated by the sign of @code{S}.
6106 @item @emph{Standard}:
6112 @item @emph{Syntax}:
6113 @code{Y = NEAREST(X, S)}
6115 @item @emph{Arguments}:
6116 @multitable @columnfractions .15 .80
6117 @item @var{X} @tab shall be of type @code{REAL}.
6118 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
6122 @item @emph{Return value}:
6123 The return value is of the same type as @code{X}. If @code{S} is
6124 positive, @code{NEAREST} returns the processor-representable number
6125 greater than @code{X} and nearest to it. If @code{S} is negative,
6126 @code{NEAREST} returns the processor-representable number smaller than
6127 @code{X} and nearest to it.
6129 @item @emph{Example}:
6131 program test_nearest
6133 x = nearest(42.0, 1.0)
6134 y = nearest(42.0, -1.0)
6135 write (*,"(3(G20.15))") x, y, x - y
6136 end program test_nearest
6143 @section @code{NEW_LINE} --- New line character
6144 @findex @code{NEW_LINE} intrinsic
6145 @findex @code{NEW_LINE} intrinsic
6148 @item @emph{Description}:
6149 @code{NEW_LINE(C)} returns the new-line character
6151 @item @emph{Standard}:
6157 @item @emph{Syntax}:
6158 @code{C = NEW_LINE(C)}
6160 @item @emph{Arguments}:
6161 @multitable @columnfractions .15 .80
6162 @item @var{C} @tab The argument shall be a scalar or array of the
6163 type @code{CHARACTER}.
6166 @item @emph{Return value}:
6167 Returns a @var{CHARACTER} scalar of length one with the new-line character of
6168 the same kind as parameter @var{C}.
6170 @item @emph{Example}:
6174 write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6182 @section @code{NINT} --- Nearest whole number
6183 @findex @code{NINT} intrinsic
6184 @findex @code{IDNINT} intrinsic
6185 @cindex whole number
6188 @item @emph{Description}:
6189 @code{NINT(X)} rounds its argument to the nearest whole number.
6191 @item @emph{Standard}:
6197 @item @emph{Syntax}:
6200 @item @emph{Arguments}:
6201 @multitable @columnfractions .15 .80
6202 @item @var{X} @tab The type of the argument shall be @code{REAL}.
6205 @item @emph{Return value}:
6206 Returns @var{A} with the fractional portion of its magnitude eliminated by
6207 rounding to the nearest whole number and with its sign preserved,
6208 converted to an @code{INTEGER} of the default kind.
6210 @item @emph{Example}:
6217 print *, nint(x4), idnint(x8)
6218 end program test_nint
6221 @item @emph{Specific names}:
6222 @multitable @columnfractions .33 .33 .33
6223 @item Name @tab Argument @tab Standard
6224 @item @code{IDNINT(X)} @tab @code{REAL(8)} @tab F95 and later
6227 @item @emph{See also}:
6228 @ref{CEILING}, @ref{FLOOR}
6234 @section @code{NOT} --- Logical negation
6235 @findex @code{NOT} intrinsic
6236 @cindex logical operations
6238 Intrinsic implemented, documentation pending.
6241 @item @emph{Description}:
6242 @item @emph{Standard}:
6248 @item @emph{Syntax}:
6249 @item @emph{Arguments}:
6250 @item @emph{Return value}:
6251 @item @emph{Example}:
6252 @item @emph{See also}:
6259 @section @code{NULL} --- Function that returns an disassociated pointer
6260 @findex @code{NULL} 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}:
6277 @item @emph{See also}:
6285 @section @code{OR} --- Bitwise logical OR
6286 @findex @code{OR} intrinsic
6287 @cindex bit operations
6290 @item @emph{Description}:
6291 Bitwise logical @code{OR}.
6293 This intrinsic routine is provided for backwards compatibility with
6294 GNU Fortran 77. For integer arguments, programmers should consider
6295 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6297 @item @emph{Standard}:
6301 Non-elemental function
6303 @item @emph{Syntax}:
6304 @code{RESULT = OR(X, Y)}
6306 @item @emph{Arguments}:
6307 @multitable @columnfractions .15 .80
6308 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6309 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6312 @item @emph{Return value}:
6313 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
6314 after cross-promotion of the arguments.
6316 @item @emph{Example}:
6319 LOGICAL :: T = .TRUE., F = ..FALSE.
6321 DATA a / Z'F' /, b / Z'3' /
6323 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6324 WRITE (*,*) OR(a, b)
6328 @item @emph{See also}:
6329 F95 elemental function: @ref{IOR}
6336 @section @code{PACK} --- Pack an array into an array of rank one
6337 @findex @code{PACK} intrinsic
6338 @cindex undocumented intrinsic
6340 Intrinsic implemented, documentation pending.
6343 @item @emph{Description}:
6344 @item @emph{Standard}:
6348 Transformational function
6350 @item @emph{Syntax}:
6351 @item @emph{Arguments}:
6352 @item @emph{Return value}:
6353 @item @emph{Example}:
6354 @item @emph{Specific names}:
6355 @item @emph{See also}:
6363 @section @code{PERROR} --- Print system error message
6364 @findex @code{PERROR} intrinsic
6365 @cindex undocumented intrinsic
6367 Intrinsic implemented, documentation pending.
6370 @item @emph{Description}:
6371 @item @emph{Standard}:
6377 @item @emph{Syntax}:
6378 @item @emph{Arguments}:
6379 @item @emph{Return value}:
6380 @item @emph{Example}:
6381 @item @emph{Specific names}:
6382 @item @emph{See also}:
6390 @section @code{PRECISION} --- Decimal precision of a real kind
6391 @findex @code{PRECISION} intrinsic
6395 @item @emph{Description}:
6396 @code{PRECISION(X)} returns the decimal precision in the model of the
6399 @item @emph{Standard}:
6405 @item @emph{Syntax}:
6406 @code{I = PRECISION(X)}
6408 @item @emph{Arguments}:
6409 @multitable @columnfractions .15 .80
6410 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6413 @item @emph{Return value}:
6414 The return value is of type @code{INTEGER} and of the default integer
6417 @item @emph{Example}:
6419 program prec_and_range
6420 real(kind=4) :: x(2)
6421 complex(kind=8) :: y
6423 print *, precision(x), range(x)
6424 print *, precision(y), range(y)
6425 end program prec_and_range
6432 @section @code{PRESENT} --- Determine whether an optional argument is specified
6433 @findex @code{PRESENT} intrinsic
6434 @cindex undocumented intrinsic
6436 Intrinsic implemented, documentation pending.
6439 @item @emph{Description}:
6440 @item @emph{Standard}:
6446 @item @emph{Syntax}:
6447 @item @emph{Arguments}:
6448 @item @emph{Return value}:
6449 @item @emph{Example}:
6450 @item @emph{See also}:
6457 @section @code{PRODUCT} --- Product of array elements
6458 @findex @code{PRODUCT} intrinsic
6459 @cindex undocumented intrinsic
6461 Intrinsic implemented, documentation pending.
6464 @item @emph{Description}:
6465 @item @emph{Standard}:
6469 Transformational function
6471 @item @emph{Syntax}:
6472 @item @emph{Arguments}:
6473 @item @emph{Return value}:
6474 @item @emph{Example}:
6475 @item @emph{Specific names}:
6476 @item @emph{See also}:
6484 @section @code{RADIX} --- Base of a model number
6485 @findex @code{RADIX} intrinsic
6489 @item @emph{Description}:
6490 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6492 @item @emph{Standard}:
6498 @item @emph{Syntax}:
6501 @item @emph{Arguments}:
6502 @multitable @columnfractions .15 .80
6503 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6506 @item @emph{Return value}:
6507 The return value is a scalar of type @code{INTEGER} and of the default
6510 @item @emph{Example}:
6513 print *, "The radix for the default integer kind is", radix(0)
6514 print *, "The radix for the default real kind is", radix(0.0)
6515 end program test_radix
6523 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6524 @findex @code{RANDOM_NUMBER} intrinsic
6525 @cindex random numbers
6527 Intrinsic implemented, documentation pending.
6530 @item @emph{Description}:
6531 @item @emph{Standard}:
6535 Elemental subroutine
6537 @item @emph{Syntax}:
6538 @item @emph{Arguments}:
6539 @item @emph{Return value}:
6540 @item @emph{Example}:
6541 @item @emph{See also}:
6549 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6550 @findex @code{RANDOM_SEED} intrinsic
6551 @cindex random numbers
6553 Intrinsic implemented, documentation pending.
6556 @item @emph{Description}:
6557 @item @emph{Standard}:
6563 @item @emph{Syntax}:
6564 @item @emph{Arguments}:
6565 @item @emph{Return value}:
6566 @item @emph{Example}:
6567 @item @emph{See also}:
6575 @section @code{RAND} --- Real pseudo-random number
6576 @findex @code{RAND} intrinsic
6577 @findex @code{RAN} intrinsic
6578 @cindex random number
6581 @item @emph{Description}:
6582 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6583 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6584 in the current sequence is returned; if @var{FLAG} is 1, the generator
6585 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6586 it is used as a new seed with @code{SRAND}.
6588 @item @emph{Standard}:
6592 non-elemental function
6594 @item @emph{Syntax}:
6595 @code{X = RAND(FLAG)}
6597 @item @emph{Arguments}:
6598 @multitable @columnfractions .15 .80
6599 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6602 @item @emph{Return value}:
6603 The return value is of @code{REAL} type and the default kind.
6605 @item @emph{Example}:
6608 integer,parameter :: seed = 86456
6611 print *, rand(), rand(), rand(), rand()
6612 print *, rand(seed), rand(), rand(), rand()
6613 end program test_rand
6617 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6618 provided as an alias for @code{RAND}.
6620 @item @emph{See also}:
6621 @ref{SRAND}, @ref{RANDOM_NUMBER}
6628 @section @code{RANGE} --- Decimal exponent range of a real kind
6629 @findex @code{RANGE} intrinsic
6633 @item @emph{Description}:
6634 @code{RANGE(X)} returns the decimal exponent range in the model of the
6637 @item @emph{Standard}:
6643 @item @emph{Syntax}:
6646 @item @emph{Arguments}:
6647 @multitable @columnfractions .15 .80
6648 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6651 @item @emph{Return value}:
6652 The return value is of type @code{INTEGER} and of the default integer
6655 @item @emph{Example}:
6656 See @code{PRECISION} for an example.
6662 @section @code{RAN} --- Real pseudo-random number
6663 @findex @code{RAN} intrinsic
6664 @cindex random number
6667 @item @emph{Standard}:
6670 @item @emph{See also}:
6671 @ref{RAND}, @ref{RANDOM_NUMBER}
6677 @section @code{REAL} --- Convert to real type
6678 @findex @code{REAL} intrinsic
6679 @findex @code{REALPART} intrinsic
6683 @item @emph{Description}:
6684 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
6685 @code{REALPART(X)} function is provided for compatibility with @command{g77},
6686 and its use is strongly discouraged.
6688 @item @emph{Standard}:
6694 @item @emph{Syntax}:
6695 @multitable @columnfractions .30 .80
6696 @item @code{X = REAL(X)}
6697 @item @code{X = REAL(X, KIND)}
6698 @item @code{X = REALPART(Z)}
6701 @item @emph{Arguments}:
6702 @multitable @columnfractions .15 .80
6703 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
6705 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
6708 @item @emph{Return value}:
6709 These functions return a @code{REAL(*)} variable or array under
6710 the following rules:
6714 @code{REAL(X)} is converted to a default real type if @var{X} is an
6715 integer or real variable.
6717 @code{REAL(X)} is converted to a real type with the kind type parameter
6718 of @var{X} if @var{X} is a complex variable.
6720 @code{REAL(X, KIND)} is converted to a real type with kind type
6721 parameter @var{KIND} if @var{X} is a complex, integer, or real
6725 @item @emph{Example}:
6728 complex :: x = (1.0, 2.0)
6729 print *, real(x), real(x,8), realpart(x)
6730 end program test_real
6733 @item @emph{See also}:
6734 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
6740 @section @code{RENAME} --- Rename a file
6741 @findex @code{RENAME} intrinsic
6742 @cindex file system operations
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{See also}:
6765 @section @code{REPEAT} --- Repeated string concatenation
6766 @findex @code{REPEAT} intrinsic
6767 @cindex string manipulation
6769 Intrinsic implemented, documentation pending.
6772 @item @emph{Description}:
6773 @item @emph{Standard}:
6777 Transformational function
6779 @item @emph{Syntax}:
6780 @item @emph{Arguments}:
6781 @item @emph{Return value}:
6782 @item @emph{Example}:
6783 @item @emph{See also}:
6790 @section @code{RESHAPE} --- Function to reshape an array
6791 @findex @code{RESHAPE} intrinsic
6792 @cindex array manipulation
6794 Intrinsic implemented, documentation pending.
6797 @item @emph{Description}:
6798 @item @emph{Standard}:
6802 Transformational function
6804 @item @emph{Syntax}:
6805 @item @emph{Arguments}:
6806 @item @emph{Return value}:
6807 @item @emph{Example}:
6808 @item @emph{See also}:
6815 @section @code{RRSPACING} --- Reciprocal of the relative spacing
6816 @findex @code{RRSPACING} intrinsic
6819 @item @emph{Description}:
6820 @code{RRSPACING(X)} returns the reciprocal of the relative spacing of
6821 model numbers near @var{X}.
6823 @item @emph{Standard}:
6829 @item @emph{Syntax}:
6830 @code{Y = RRSPACING(X)}
6832 @item @emph{Arguments}:
6833 @multitable @columnfractions .15 .80
6834 @item @var{X} @tab shall be of type @code{REAL}.
6837 @item @emph{Return value}:
6838 The return value is of the same type and kind as @var{X}.
6839 The value returned is equal to
6840 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
6847 @section @code{RSHIFT} --- Right shift bits
6848 @findex @code{RSHIFT}
6849 @cindex bit manipulation
6851 Not yet implemented in GNU Fortran.
6854 @item @emph{Description}:
6856 @item @emph{Standard}:
6862 @item @emph{Syntax}:
6863 @item @emph{Arguments}:
6864 @item @emph{Return value}:
6865 @item @emph{Example}:
6866 @item @emph{See also}:
6873 @section @code{SCALE} --- Scale a real value
6874 @findex @code{SCALE} intrinsic
6877 @item @emph{Description}:
6878 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
6880 @item @emph{Standard}:
6886 @item @emph{Syntax}:
6887 @code{Y = SCALE(X, I)}
6889 @item @emph{Arguments}:
6890 @multitable @columnfractions .15 .80
6891 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
6892 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
6895 @item @emph{Return value}:
6896 The return value is of the same type and kind as @var{X}.
6897 Its value is @code{X * RADIX(X)**I}.
6899 @item @emph{Example}:
6902 real :: x = 178.1387e-4
6904 print *, scale(x,i), x*radix(x)**i
6905 end program test_scale
6912 @section @code{SCAN} --- Scan a string for the presence of a set of characters
6913 @findex @code{SCAN} intrinsic
6914 @cindex string manipulation
6916 Intrinsic implemented, documentation pending.
6919 @item @emph{Description}:
6920 @item @emph{Standard}:
6926 @item @emph{Syntax}:
6927 @item @emph{Arguments}:
6928 @item @emph{Return value}:
6929 @item @emph{Example}:
6930 @item @emph{See also}:
6937 @section @code{SECNDS} --- Time function
6938 @findex @code{SECNDS} intrinsic
6942 @item @emph{Description}:
6943 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
6944 @var{X} is a reference time, also in seconds. If this is zero, the time in
6945 seconds from midnight is returned. This function is non-standard and its
6948 @item @emph{Standard}:
6954 @item @emph{Syntax}:
6955 @code{T = SECNDS (X)}
6957 @item @emph{Arguments}:
6958 @multitable @columnfractions .15 .80
6959 @item Name @tab Type
6960 @item @var{T} @tab REAL(4)
6961 @item @var{X} @tab REAL(4)
6964 @item @emph{Return value}:
6967 @item @emph{Example}:
6971 print *, secnds (0.0) ! seconds since midnight
6972 t1 = secnds (0.0) ! reference time
6973 do i = 1, 10000000 ! do something
6975 t2 = secnds (t1) ! elapsed time
6976 print *, "Something took ", t2, " seconds."
6977 end program test_secnds
6983 @node SELECTED_INT_KIND
6984 @section @code{SELECTED_INT_KIND} --- Choose integer kind
6985 @findex @code{SELECTED_INT_KIND} intrinsic
6986 @cindex integer kind
6989 @item @emph{Description}:
6990 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
6991 type that can represent all values ranging from @math{-10^I} (exclusive)
6992 to @math{10^I} (exclusive). If there is no integer kind that accommodates
6993 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
6995 @item @emph{Standard}:
6999 Transformational function
7001 @item @emph{Syntax}:
7002 @multitable @columnfractions .30 .80
7003 @item @code{J = SELECTED_INT_KIND(I)}
7006 @item @emph{Arguments}:
7007 @multitable @columnfractions .15 .80
7008 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7011 @item @emph{Example}:
7013 program large_integers
7014 integer,parameter :: k5 = selected_int_kind(5)
7015 integer,parameter :: k15 = selected_int_kind(15)
7016 integer(kind=k5) :: i5
7017 integer(kind=k15) :: i15
7019 print *, huge(i5), huge(i15)
7021 ! The following inequalities are always true
7022 print *, huge(i5) >= 10_k5**5-1
7023 print *, huge(i15) >= 10_k15**15-1
7024 end program large_integers
7030 @node SELECTED_REAL_KIND
7031 @section @code{SELECTED_REAL_KIND} --- Choose real kind
7032 @findex @code{SELECTED_REAL_KIND} intrinsic
7036 @item @emph{Description}:
7037 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7038 with decimal precision greater of at least @code{P} digits and exponent
7039 range greater at least @code{R}.
7041 @item @emph{Standard}:
7045 Transformational function
7047 @item @emph{Syntax}:
7048 @multitable @columnfractions .30 .80
7049 @item @code{I = SELECTED_REAL_KIND(P,R)}
7052 @item @emph{Arguments}:
7053 @multitable @columnfractions .15 .80
7054 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7055 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7057 At least one argument shall be present.
7059 @item @emph{Return value}:
7061 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7062 a real data type with decimal precision of at least @code{P} digits and a
7063 decimal exponent range of at least @code{R}. If more than one real data
7064 type meet the criteria, the kind of the data type with the smallest
7065 decimal precision is returned. If no real data type matches the criteria,
7068 @item -1 if the processor does not support a real data type with a
7069 precision greater than or equal to @code{P}
7070 @item -2 if the processor does not support a real type with an exponent
7071 range greater than or equal to @code{R}
7072 @item -3 if neither is supported.
7075 @item @emph{Example}:
7078 integer,parameter :: p6 = selected_real_kind(6)
7079 integer,parameter :: p10r100 = selected_real_kind(10,100)
7080 integer,parameter :: r400 = selected_real_kind(r=400)
7082 real(kind=p10r100) :: y
7083 real(kind=r400) :: z
7085 print *, precision(x), range(x)
7086 print *, precision(y), range(y)
7087 print *, precision(z), range(z)
7088 end program real_kinds
7095 @section @code{SET_EXPONENT} --- Set the exponent of the model
7096 @findex @code{SET_EXPONENT} intrinsic
7100 @item @emph{Description}:
7101 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
7102 is that that of @var{X} and whose exponent part if @var{I}.
7104 @item @emph{Standard}:
7110 @item @emph{Syntax}:
7111 @code{Y = SET_EXPONENT(X, I)}
7113 @item @emph{Arguments}:
7114 @multitable @columnfractions .15 .80
7115 @item @var{X} @tab shall be of type @code{REAL}.
7116 @item @var{I} @tab shall be of type @code{INTEGER}.
7119 @item @emph{Return value}:
7120 The return value is of the same type and kind as @var{X}.
7121 The real number whose fractional part
7122 is that that of @var{X} and whose exponent part if @var{I} is returned;
7123 it is @code{FRACTION(X) * RADIX(X)**I}.
7125 @item @emph{Example}:
7128 real :: x = 178.1387e-4
7130 print *, set_exponent(x), fraction(x) * radix(x)**i
7131 end program test_setexp
7139 @section @code{SHAPE} --- Determine the shape of an array
7140 @findex @code{SHAPE} intrinsic
7141 @cindex array manipulation
7143 Intrinsic implemented, documentation pending.
7146 @item @emph{Description}:
7147 @item @emph{Standard}:
7153 @item @emph{Syntax}:
7154 @item @emph{Arguments}:
7155 @item @emph{Return value}:
7156 @item @emph{Example}:
7157 @item @emph{See also}:
7165 @section @code{SIGN} --- Sign copying function
7166 @findex @code{SIGN} intrinsic
7167 @findex @code{ISIGN} intrinsic
7168 @findex @code{DSIGN} intrinsic
7169 @cindex sign copying
7172 @item @emph{Description}:
7173 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
7175 @item @emph{Standard}:
7181 @item @emph{Syntax}:
7182 @code{X = SIGN(A,B)}
7184 @item @emph{Arguments}:
7185 @multitable @columnfractions .15 .80
7186 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7187 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
7190 @item @emph{Return value}:
7191 The kind of the return value is that of @var{A} and @var{B}.
7192 If @math{B\ge 0} then the result is @code{ABS(A)}, else
7193 it is @code{-ABS(A)}.
7195 @item @emph{Example}:
7198 print *, sign(-12,1)
7199 print *, sign(-12,0)
7200 print *, sign(-12,-1)
7202 print *, sign(-12.,1.)
7203 print *, sign(-12.,0.)
7204 print *, sign(-12.,-1.)
7205 end program test_sign
7208 @item @emph{Specific names}:
7209 @multitable @columnfractions .20 .20 .20 .40
7210 @item Name @tab Arguments @tab Return type @tab Standard
7211 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7212 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7219 @section @code{SIGNAL} --- Signal handling subroutine (or function)
7220 @findex @code{SIGNAL} intrinsic
7221 @cindex SIGNAL subroutine
7224 @item @emph{Description}:
7225 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7226 @var{HANDLER} to be executed with a single integer argument when signal
7227 @var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
7228 turn off handling of signal @var{NUMBER} or revert to its default
7229 action. See @code{signal(2)}.
7231 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7232 is supplied, it is set to the value returned by @code{signal(2)}.
7234 @item @emph{Standard}:
7238 subroutine, non-elemental function
7240 @item @emph{Syntax}:
7241 @multitable @columnfractions .30 .80
7242 @item @code{CALL ALARM(NUMBER, HANDLER)}
7243 @item @code{CALL ALARM(NUMBER, HANDLER, STATUS)}
7244 @item @code{STATUS = ALARM(NUMBER, HANDLER)}
7247 @item @emph{Arguments}:
7248 @multitable @columnfractions .15 .80
7249 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7250 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7251 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7252 @code{INTEGER}. It is @code{INTENT(IN)}.
7253 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7254 integer. It has @code{INTENT(OUT)}.
7257 @item @emph{Return value}:
7258 The @code{SIGNAL} functions returns the value returned by @code{signal(2)}.
7260 @item @emph{Example}:
7264 external handler_print
7266 call signal (12, handler_print)
7270 end program test_signal
7278 @section @code{SIN} --- Sine function
7279 @findex @code{SIN} intrinsic
7280 @findex @code{DSIN} intrinsic
7281 @findex @code{ZSIN} intrinsic
7282 @findex @code{CDSIN} intrinsic
7283 @cindex trigonometric functions
7286 @item @emph{Description}:
7287 @code{SIN(X)} computes the sine of @var{X}.
7289 @item @emph{Standard}:
7295 @item @emph{Syntax}:
7298 @item @emph{Arguments}:
7299 @multitable @columnfractions .15 .80
7300 @item @var{X} @tab The type shall be @code{REAL(*)} or
7304 @item @emph{Return value}:
7305 The return value has same type and kind as @var{X}.
7307 @item @emph{Example}:
7312 end program test_sin
7315 @item @emph{Specific names}:
7316 @multitable @columnfractions .20 .20 .20 .40
7317 @item Name @tab Argument @tab Return type @tab Standard
7318 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
7319 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
7320 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7321 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7324 @item @emph{See also}:
7331 @section @code{SINH} --- Hyperbolic sine function
7332 @findex @code{SINH} intrinsic
7333 @findex @code{DSINH} intrinsic
7334 @cindex hyperbolic sine
7337 @item @emph{Description}:
7338 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7340 @item @emph{Standard}:
7346 @item @emph{Syntax}:
7349 @item @emph{Arguments}:
7350 @multitable @columnfractions .15 .80
7351 @item @var{X} @tab The type shall be @code{REAL(*)}.
7354 @item @emph{Return value}:
7355 The return value is of type @code{REAL(*)}.
7357 @item @emph{Example}:
7360 real(8) :: x = - 1.0_8
7362 end program test_sinh
7365 @item @emph{Specific names}:
7366 @multitable @columnfractions .20 .20 .20 .40
7367 @item Name @tab Argument @tab Return type @tab Standard
7368 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7371 @item @emph{See also}:
7378 @section @code{SIZE} --- Determine the size of an array
7379 @findex @code{SIZE} intrinsic
7380 @cindex array manipulation
7382 Intrinsic implemented, documentation pending.
7385 @item @emph{Description}:
7386 @item @emph{Standard}:
7392 @item @emph{Syntax}:
7393 @item @emph{Arguments}:
7394 @item @emph{Return value}:
7395 @item @emph{Example}:
7396 @item @emph{See also}:
7402 @section @code{SNGL} --- Convert double precision real to default real
7403 @findex @code{SNGL} intrinsic
7404 @cindex conversion function (real)
7407 @item @emph{Description}:
7408 @code{SNGL(A)} converts the double precision real @var{A}
7409 to a default real value. This is an archaic form of @code{REAL}
7410 that is specific to one type for @var{A}.
7412 @item @emph{Standard}:
7418 @item @emph{Syntax}:
7421 @item @emph{Arguments}:
7422 @multitable @columnfractions .15 .80
7423 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7426 @item @emph{Return value}:
7427 The return value is of type default @code{REAL}.
7429 @item @emph{See also}:
7436 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7437 @findex @code{SPACING} intrinsic
7438 @cindex undocumented intrinsic
7440 Intrinsic implemented, documentation pending.
7443 @item @emph{Description}:
7444 @item @emph{Standard}:
7450 @item @emph{Syntax}:
7451 @item @emph{Arguments}:
7452 @item @emph{Return value}:
7453 @item @emph{Example}:
7454 @item @emph{See also}:
7461 @section @code{SPREAD} --- Add a dimension to an array
7462 @findex @code{SPREAD} intrinsic
7463 @cindex array manipulation
7465 Intrinsic implemented, documentation pending.
7468 @item @emph{Description}:
7469 @item @emph{Standard}:
7473 Transformational function
7475 @item @emph{Syntax}:
7476 @item @emph{Arguments}:
7477 @item @emph{Return value}:
7478 @item @emph{Example}:
7479 @item @emph{See also}:
7486 @section @code{SQRT} --- Square-root function
7487 @findex @code{SQRT} intrinsic
7488 @findex @code{DSQRT} intrinsic
7489 @findex @code{CSQRT} intrinsic
7490 @findex @code{ZSQRT} intrinsic
7491 @findex @code{CDSQRT} intrinsic
7495 @item @emph{Description}:
7496 @code{SQRT(X)} computes the square root of @var{X}.
7498 @item @emph{Standard}:
7504 @item @emph{Syntax}:
7507 @item @emph{Arguments}:
7508 @multitable @columnfractions .15 .80
7509 @item @var{X} @tab The type shall be @code{REAL(*)} or
7513 @item @emph{Return value}:
7514 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7515 The kind type parameter is the same as @var{X}.
7517 @item @emph{Example}:
7520 real(8) :: x = 2.0_8
7521 complex :: z = (1.0, 2.0)
7524 end program test_sqrt
7527 @item @emph{Specific names}:
7528 @multitable @columnfractions .20 .20 .20 .40
7529 @item Name @tab Argument @tab Return type @tab Standard
7530 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7531 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F95 and later
7532 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7533 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7540 @section @code{SRAND} --- Reinitialize the random number generator
7541 @findex @code{SRAND} intrinsic
7542 @cindex random number
7545 @item @emph{Description}:
7546 @code{SRAND} reinitializes the pseudo-random number generator
7547 called by @code{RAND} and @code{IRAND}. The new seed used by the
7548 generator is specified by the required argument @var{SEED}.
7550 @item @emph{Standard}:
7554 non-elemental subroutine
7556 @item @emph{Syntax}:
7557 @code{CALL SRAND(SEED)}
7559 @item @emph{Arguments}:
7560 @multitable @columnfractions .15 .80
7561 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7564 @item @emph{Return value}:
7567 @item @emph{Example}:
7568 See @code{RAND} and @code{IRAND} for examples.
7571 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7572 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7573 to generate pseudo-random numbers. Please note that in
7574 GNU Fortran, these two sets of intrinsics (@code{RAND},
7575 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7576 @code{RANDOM_SEED} on the other hand) access two independent
7577 pseudo-random number generators.
7579 @item @emph{See also}:
7580 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7586 @section @code{STAT} --- Get file status
7587 @findex @code{STAT} intrinsic
7588 @cindex file system operations
7591 @item @emph{Description}:
7592 This function returns information about a file. No permissions are required on
7593 the file itself, but execute (search) permission is required on all of the
7594 directories in path that lead to the file.
7596 The elements that are obtained and stored in the array @code{BUFF}:
7597 @multitable @columnfractions .15 .80
7598 @item @code{buff(1)} @tab Device ID
7599 @item @code{buff(2)} @tab Inode number
7600 @item @code{buff(3)} @tab File mode
7601 @item @code{buff(4)} @tab Number of links
7602 @item @code{buff(5)} @tab Owner's uid
7603 @item @code{buff(6)} @tab Owner's gid
7604 @item @code{buff(7)} @tab ID of device containing directory entry for file (0 if not available)
7605 @item @code{buff(8)} @tab File size (bytes)
7606 @item @code{buff(9)} @tab Last access time
7607 @item @code{buff(10)} @tab Last modification time
7608 @item @code{buff(11)} @tab Last file status change time
7609 @item @code{buff(12)} @tab Preferred I/O block size (-1 if not available)
7610 @item @code{buff(13)} @tab Number of blocks allocated (-1 if not available)
7613 Not all these elements are relevant on all systems.
7614 If an element is not relevant, it is returned as 0.
7617 @item @emph{Standard}:
7621 Non-elemental subroutine
7623 @item @emph{Syntax}:
7624 @code{CALL STAT(FILE,BUFF[,STATUS])}
7626 @item @emph{Arguments}:
7627 @multitable @columnfractions .15 .80
7628 @item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
7629 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
7630 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
7631 on success and a system specific error code otherwise.
7634 @item @emph{Example}:
7637 INTEGER, DIMENSION(13) :: buff
7640 CALL STAT("/etc/passwd", statarr, status)
7642 IF (status == 0) THEN
7643 WRITE (*, FMT="('Device ID:', T40, I19)") buff(1)
7644 WRITE (*, FMT="('Inode number:', T40, I19)") buff(2)
7645 WRITE (*, FMT="('File mode:', T40, o19)") buff(3)
7646 WRITE (*, FMT="('Number of links:', T40, I19)") buff(4)
7647 WRITE (*, FMT="('Owner''s uid:', T40, I19)") buff(5)
7648 WRITE (*, FMT="('Owner''s gid:', T40, I19)") buff(6)
7649 WRITE (*, FMT="('Device where directory is located:', T40, I19)") buff(7)
7650 WRITE (*, FMT="('File size:', T40, I19)") buff(8)
7651 WRITE (*, FMT="('Last access time:', T40, A19)") CTIME(buff(9))
7652 WRITE (*, FMT="('Last modification time', T40, A19)") CTIME(buff(10))
7653 WRITE (*, FMT="('Last file status change time:', T40, A19)") CTIME(buff(11))
7654 WRITE (*, FMT="('Preferred I/O block size:', T40, I19)") buff(12)
7655 WRITE (*, FMT="('Number of blocks allocated:', T40, I19)") buff(13)
7660 @item @emph{See also}:
7661 To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
7667 @section @code{SUM} --- Sum of array elements
7668 @findex @code{SUM} intrinsic
7669 @cindex array manipulation
7671 Intrinsic implemented, documentation pending.
7674 @item @emph{Description}:
7675 @item @emph{Standard}:
7679 Transformational function
7681 @item @emph{Syntax}:
7682 @item @emph{Arguments}:
7683 @item @emph{Return value}:
7684 @item @emph{Example}:
7685 @item @emph{See also}:
7693 @section @code{SYMLNK} --- Create a symbolic link
7694 @findex @code{SYMLNK} intrinsic
7695 @cindex file system operations
7697 Intrinsic implemented, documentation pending.
7700 @item @emph{Description}:
7701 @item @emph{Standard}:
7705 @item @emph{Syntax}:
7706 @item @emph{Arguments}:
7707 @item @emph{Return value}:
7708 @item @emph{Example}:
7709 @item @emph{See also}:
7716 @section @code{SYSTEM} --- Execute a shell command
7717 @findex @code{SYSTEM} intrinsic
7718 @cindex undocumented intrinsic
7720 Intrinsic implemented, documentation pending.
7723 @item @emph{Description}:
7724 @item @emph{Standard}:
7730 @item @emph{Syntax}:
7731 @item @emph{Arguments}:
7732 @item @emph{Return value}:
7733 @item @emph{Example}:
7734 @item @emph{See also}:
7741 @section @code{SYSTEM_CLOCK} --- Time function
7742 @findex @code{SYSTEM_CLOCK} intrinsic
7743 @cindex time functions
7745 Intrinsic implemented, documentation pending.
7748 @item @emph{Description}:
7749 @item @emph{Standard}:
7755 @item @emph{Syntax}:
7756 @item @emph{Arguments}:
7757 @item @emph{Return value}:
7758 @item @emph{Example}:
7759 @item @emph{See also}:
7765 @section @code{TAN} --- Tangent function
7766 @findex @code{TAN} intrinsic
7767 @findex @code{DTAN} intrinsic
7768 @cindex trigonometric functions
7771 @item @emph{Description}:
7772 @code{TAN(X)} computes the tangent of @var{X}.
7774 @item @emph{Standard}:
7780 @item @emph{Syntax}:
7783 @item @emph{Arguments}:
7784 @multitable @columnfractions .15 .80
7785 @item @var{X} @tab The type shall be @code{REAL(*)}.
7788 @item @emph{Return value}:
7789 The return value is of type @code{REAL(*)}. The kind type parameter is
7790 the same as @var{X}.
7792 @item @emph{Example}:
7795 real(8) :: x = 0.165_8
7797 end program test_tan
7800 @item @emph{Specific names}:
7801 @multitable @columnfractions .20 .20 .20 .40
7802 @item Name @tab Argument @tab Return type @tab Standard
7803 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7806 @item @emph{See also}:
7813 @section @code{TANH} --- Hyperbolic tangent function
7814 @findex @code{TANH} intrinsic
7815 @findex @code{DTANH} intrinsic
7816 @cindex hyperbolic tangent
7819 @item @emph{Description}:
7820 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
7822 @item @emph{Standard}:
7828 @item @emph{Syntax}:
7831 @item @emph{Arguments}:
7832 @multitable @columnfractions .15 .80
7833 @item @var{X} @tab The type shall be @code{REAL(*)}.
7836 @item @emph{Return value}:
7837 The return value is of type @code{REAL(*)} and lies in the range
7838 @math{ - 1 \leq tanh(x) \leq 1 }.
7840 @item @emph{Example}:
7843 real(8) :: x = 2.1_8
7845 end program test_tanh
7848 @item @emph{Specific names}:
7849 @multitable @columnfractions .20 .20 .20 .40
7850 @item Name @tab Argument @tab Return type @tab Standard
7851 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7854 @item @emph{See also}:
7861 @section @code{TIME} --- Time function
7862 @findex @code{TIME} intrinsic
7863 @cindex time functions
7865 Intrinsic implemented, documentation pending.
7868 @item @emph{Description}:
7869 @item @emph{Standard}:
7873 Non-elemental function
7875 @item @emph{Syntax}:
7876 @item @emph{Arguments}:
7877 @item @emph{Return value}:
7878 @item @emph{Example}:
7879 @item @emph{See also}:
7885 @section @code{TINY} --- Smallest positive number of a real kind
7886 @findex @code{TINY} intrinsic
7890 @item @emph{Description}:
7891 @code{TINY(X)} returns the smallest positive (non zero) number
7892 in the model of the type of @code{X}.
7894 @item @emph{Standard}:
7900 @item @emph{Syntax}:
7903 @item @emph{Arguments}:
7904 @multitable @columnfractions .15 .80
7905 @item @var{X} @tab shall be of type @code{REAL}.
7908 @item @emph{Return value}:
7909 The return value is of the same type and kind as @var{X}
7911 @item @emph{Example}:
7912 See @code{HUGE} for an example.
7918 @section @code{TRANSFER} --- Transfer bit patterns
7919 @findex @code{TRANSFER} intrinsic
7920 @cindex bit manipulation
7922 Intrinsic implemented, documentation pending.
7925 @item @emph{Description}:
7926 @item @emph{Standard}:
7930 Transformational function
7932 @item @emph{Syntax}:
7933 @item @emph{Arguments}:
7934 @item @emph{Return value}:
7935 @item @emph{Example}:
7936 @item @emph{See also}:
7943 @section @code{TRANSPOSE} --- Transpose an array of rank two
7944 @findex @code{TRANSPOSE} intrinsic
7945 @cindex matrix manipulation
7947 Intrinsic implemented, documentation pending.
7950 @item @emph{Description}:
7951 @item @emph{Standard}:
7955 Transformational function
7957 @item @emph{Syntax}:
7958 @item @emph{Arguments}:
7959 @item @emph{Return value}:
7960 @item @emph{Example}:
7961 @item @emph{See also}:
7968 @section @code{TRIM} --- Function to remove trailing blank characters of a string
7969 @findex @code{TRIM} intrinsic
7970 @cindex string manipulation
7972 Intrinsic implemented, documentation pending.
7975 @item @emph{Description}:
7976 @item @emph{Standard}:
7980 Transformational function
7982 @item @emph{Syntax}:
7983 @item @emph{Arguments}:
7984 @item @emph{Return value}:
7985 @item @emph{Example}:
7986 @item @emph{See also}:
7993 @section @code{UBOUND} --- Upper dimension bounds of an array
7994 @findex @code{UBOUND} intrinsic
7995 @cindex undocumented intrinsic
7997 Intrinsic implemented, documentation pending.
8000 @item @emph{Description}:
8002 @item @emph{Standard}:
8008 @item @emph{Syntax}:
8009 @item @emph{Arguments}:
8010 @item @emph{Return value}:
8011 @item @emph{Example}:
8012 @item @emph{Specific names}:
8014 @item @emph{See also}:
8022 @section @code{UMASK} --- Set the file creation mask
8023 @findex @code{UMASK} intrinsic
8024 @cindex file system operations
8026 Intrinsic implemented, documentation pending.
8029 @item @emph{Description}:
8030 @item @emph{Standard}:
8036 @item @emph{Syntax}:
8037 @item @emph{Arguments}:
8038 @item @emph{Return value}:
8039 @item @emph{Example}:
8040 @item @emph{Specific names}:
8041 @item @emph{See also}:
8048 @section @code{UNLINK} --- Remove a file from the file system
8049 @findex @code{UNLINK} intrinsic
8050 @cindex file system operations
8052 Intrinsic implemented, documentation pending.
8055 @item @emph{Description}:
8056 @item @emph{Standard}:
8062 @item @emph{Syntax}:
8063 @item @emph{Arguments}:
8064 @item @emph{Return value}:
8065 @item @emph{Example}:
8067 @item @emph{See also}:
8075 @section @code{UNMASK} --- (?)
8076 @findex @code{UNMASK} intrinsic
8077 @cindex undocumented intrinsic
8079 Intrinsic implemented, documentation pending.
8082 @item @emph{Description}:
8083 @item @emph{Standard}:
8085 @item @emph{Syntax}:
8086 @item @emph{Arguments}:
8087 @item @emph{Return value}:
8088 @item @emph{Example}:
8089 @item @emph{Specific names}:
8090 @item @emph{See also}:
8097 @section @code{UNPACK} --- Unpack an array of rank one into an array
8098 @findex @code{UNPACK} intrinsic
8099 @cindex array manipulation
8101 Intrinsic implemented, documentation pending.
8104 @item @emph{Description}:
8105 @item @emph{Standard}:
8109 Transformational function
8111 @item @emph{Syntax}:
8112 @item @emph{Arguments}:
8113 @item @emph{Return value}:
8114 @item @emph{Example}:
8116 @item @emph{See also}:
8124 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
8125 @findex @code{VERIFY} intrinsic
8126 @cindex string manipulation
8128 Intrinsic implemented, documentation pending.
8131 @item @emph{Description}:
8132 @item @emph{Standard}:
8138 @item @emph{Syntax}:
8139 @item @emph{Arguments}:
8140 @item @emph{Return value}:
8141 @item @emph{Example}:
8142 @item @emph{Specific names}:
8143 @item @emph{See also}:
8148 @section @code{XOR} --- Bitwise logical exclusive OR
8149 @findex @code{XOR} intrinsic
8150 @cindex bit operations
8153 @item @emph{Description}:
8154 Bitwise logical exclusive or.
8156 This intrinsic routine is provided for backwards compatibility with
8157 GNU Fortran 77. For integer arguments, programmers should consider
8158 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8160 @item @emph{Standard}:
8164 Non-elemental function
8166 @item @emph{Syntax}:
8167 @code{RESULT = XOR(X, Y)}
8169 @item @emph{Arguments}:
8170 @multitable @columnfractions .15 .80
8171 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8172 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8175 @item @emph{Return value}:
8176 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8177 after cross-promotion of the arguments.
8179 @item @emph{Example}:
8182 LOGICAL :: T = .TRUE., F = .FALSE.
8184 DATA a / Z,'F' /, b / Z'3' /
8186 WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8187 WRITE (*,*) XOR(a, b)
8191 @item @emph{See also}:
8192 F95 elemental function: @ref{IEOR}