3 Free Software Foundation, Inc.
4 This is part of the GFORTRAN 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.
27 @node Intrinsic Procedures
28 @chapter Intrinsic Procedures
29 @cindex Intrinsic Procedures
31 This portion of the document is incomplete and undergoing massive expansion
32 and editing. All contributions and corrections are strongly encouraged.
34 Implemented intrinsics are fully functional and available to the user to apply.
35 Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.
38 * Introduction: Introduction
39 * @code{ABORT}: ABORT, Abort the program
40 * @code{ABS}: ABS, Absolute value
41 * @code{ACCESS}: ACCESS, Checks file access method
42 * @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
43 * @code{ACOS}: ACOS, Arccosine function
44 * @code{ACOSH}: ACOSH, Hyperbolic arccosine function
45 * @code{ADJUSTL}: ADJUSTL, Left adjust a string
46 * @code{ADJUSTR}: ADJUSTR, Right adjust a string
47 * @code{AIMAG}: AIMAG, Imaginary part of complex number
48 * @code{AINT}: AINT, Truncate to a whole number
49 * @code{ALARM}: ALARM, Set an alarm clock
50 * @code{ALL}: ALL, Determine if all values are true
51 * @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
52 * @code{AND}: AND, Logical and
53 * @code{ANINT}: ANINT, Nearest whole number
54 * @code{ANY}: ANY, Determine if any values are true
55 * @code{ASIN}: ASIN, Arcsine function
56 * @code{ASINH}: ASINH, Hyperbolic arcsine function
57 * @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
58 * @code{ATAN}: ATAN, Arctangent function
59 * @code{ATAN2}: ATAN2, Arctangent function
60 * @code{ATANH}: ATANH, Hyperbolic arctangent function
61 * @code{BESJ0}: BESJ0, Bessel function of the first kind of order 0
62 * @code{BESJ1}: BESJ1, Bessel function of the first kind of order 1
63 * @code{BESJN}: BESJN, Bessel function of the first kind
64 * @code{BESY0}: BESY0, Bessel function of the second kind of order 0
65 * @code{BESY1}: BESY1, Bessel function of the second kind of order 1
66 * @code{BESYN}: BESYN, Bessel function of the second kind
67 * @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
68 * @code{BTEST}: BTEST, Bit test function
69 * @code{CEILING}: CEILING, Integer ceiling function
70 * @code{CHAR}: CHAR, Integer-to-character conversion function
71 * @code{CHDIR}: CHDIR, Change working directory
72 * @code{CHMOD}: CHMOD, Change access permissions of files
73 * @code{CMPLX}: CMPLX, Complex conversion function
74 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Command line argument count
75 * @code{CONJG}: CONJG, Complex conjugate function
76 * @code{COS}: COS, Cosine function
77 * @code{COSH}: COSH, Hyperbolic cosine function
78 * @code{COUNT}: COUNT, Count occurrences of .TRUE. in an array
79 * @code{CPU_TIME}: CPU_TIME, CPU time subroutine
80 * @code{CSHIFT}: CSHIFT, Circular array shift function
81 * @code{CTIME}: CTIME, Subroutine (or function) to convert a time into a string
82 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
83 * @code{DBLE}: DBLE, Double precision conversion function
84 * @code{DCMPLX}: DCMPLX, Double complex conversion function
85 * @code{DFLOAT}: DFLOAT, Double precision conversion function
86 * @code{DIGITS}: DIGITS, Significant digits function
87 * @code{DIM}: DIM, Dim function
88 * @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
89 * @code{DPROD}: DPROD, Double product function
90 * @code{DREAL}: DREAL, Double real part function
91 * @code{DTIME}: DTIME, Execution time subroutine (or function)
92 * @code{EOSHIFT}: EOSHIFT, End-off shift function
93 * @code{EPSILON}: EPSILON, Epsilon function
94 * @code{EQV}: EQV, Logical equivalence
95 * @code{ERF}: ERF, Error function
96 * @code{ERFC}: ERFC, Complementary error function
97 * @code{ETIME}: ETIME, Execution time subroutine (or function)
98 * @code{EXIT}: EXIT, Exit the program with status.
99 * @code{EXP}: EXP, Exponential function
100 * @code{EXPONENT}: EXPONENT, Exponent function
101 * @code{FDATE}: FDATE, Subroutine (or function) to get the current time as a string
102 * @code{FGET}: FGET, Read a single character from stdin in stream mode
103 * @code{FGETC}: FGETC, Read a single character in stream mode
104 * @code{FLOAT}: FLOAT, Convert integer to default real
105 * @code{FLOOR}: FLOOR, Integer floor function
106 * @code{FLUSH}: FLUSH, Flush I/O unit(s)
107 * @code{FNUM}: FNUM, File number function
108 * @code{FPUT}: FPUT, Write a single character to stdout in stream mode
109 * @code{FPUTC}: FPUTC, Write a single character in stream mode
110 * @code{FRACTION}: FRACTION, Fractional part of the model representation
111 * @code{FREE}: FREE, Memory de-allocation subroutine
112 * @code{FSEEK}: FSEEK, Low level file positioning subroutine
113 * @code{FSTAT}: FSTAT, Get file status
114 * @code{FTELL}: FTELL, Current stream position
115 * @code{GETARG}: GETARG, Get command line arguments
116 * @code{GET_COMMAND}: GET_COMMAND, Subroutine to retrieve the entire command line
117 * @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Subroutine to retrieve a command argument
118 * @code{GETCWD}: GETCWD, Get current working directory
119 * @code{GETENV}: GETENV, Get an environmental variable
120 * @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
121 * @code{GETGID}: GETGID, Group ID function
122 * @code{GETLOG}: GETLOG, Get login name
123 * @code{GETPID}: GETPID, Process ID function
124 * @code{GETUID}: GETUID, User ID function
125 * @code{GMTIME}: GMTIME, Convert time to GMT info
126 * @code{HOSTNM}: HOSTNM, Get system host name
127 * @code{HUGE}: HUGE, Largest number of a kind
128 * @code{IACHAR}: IACHAR, Code in @acronym{ASCII} collating sequence
129 * @code{IAND}: IAND, Bitwise logical and
130 * @code{IARGC}: IARGC, Get number of command line arguments
131 * @code{IBCLR}: IBCLR, Clear bit
132 * @code{IBITS}: IBITS, Bit extraction
133 * @code{IBSET}: IBSET, Set bit
134 * @code{ICHAR}: ICHAR, Character-to-integer conversion function
135 * @code{IDATE}: IDATE, Current local time (day/month/year)
136 * @code{IEOR}: IEOR, Bitwise logical exclusive or
137 * @code{IERRNO}: IERRNO, Function to get the last system error number
138 * @code{INDEX}: INDEX, Position of a substring within a string
139 * @code{INT}: INT, Convert to integer type
140 * @code{IOR}: IOR, Bitwise logical or
141 * @code{IRAND}: IRAND, Integer pseudo-random number
142 * @code{ISHFT}: ISHFT, Shift bits
143 * @code{ISHFTC}: ISHFTC, Shift bits circularly
144 * @code{ITIME}: ITIME, Current local time (hour/minutes/seconds)
145 * @code{KILL}: KILL, Send a signal to a process
146 * @code{KIND}: KIND, Kind of an entity
147 * @code{LBOUND}: LBOUND, Lower dimension bounds of an array
148 * @code{LEN}: LEN, Length of a character entity
149 * @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
150 * @code{LGE}: LGE, Lexical greater than or equal
151 * @code{LGT}: LGT, Lexical greater than
152 * @code{LINK}: LINK, Create a hard link
153 * @code{LLE}: LLE, Lexical less than or equal
154 * @code{LLT}: LLT, Lexical less than
155 * @code{LNBLNK}: LNBLNK, Index of the last non-blank character in a string
156 * @code{LOC}: LOC, Returns the address of a variable
157 * @code{LOG}: LOG, Logarithm function
158 * @code{LOG10}: LOG10, Base 10 logarithm function
159 * @code{LOGICAL}: LOGICAL, Convert to logical type
160 * @code{LSHIFT}: LSHIFT, Left shift bits
161 * @code{LTIME}: LTIME, Convert time to local time info
162 * @code{MALLOC}: MALLOC, Dynamic memory allocation function
163 * @code{MATMUL}: MATMUL, matrix multiplication
164 * @code{MAX}: MAX, Maximum value of an argument list
165 * @code{MAXEXPONENT}: MAXEXPONENT, Maximum exponent of a real kind
166 * @code{MAXLOC}: MAXLOC, Location of the maximum value within an array
167 * @code{MAXVAL}: MAXVAL, Maximum value of an array
168 * @code{MERGE}: MERGE, Merge arrays
169 * @code{MIN}: MIN, Minimum value of an argument list
170 * @code{MINEXPONENT}: MINEXPONENT, Minimum exponent of a real kind
171 * @code{MINLOC}: MINLOC, Location of the minimum value within an array
172 * @code{MINVAL}: MINVAL, Minimum value of an array
173 * @code{MOD}: MOD, Remainder function
174 * @code{MODULO}: MODULO, Modulo function
175 * @code{MVBITS}: MVBITS, Move bits from one integer to another
176 * @code{NEAREST}: NEAREST, Nearest representable number
177 * @code{NEQV}: NEQV, Logical non-equivalence
178 * @code{NINT}: NINT, Nearest whole number
179 * @code{NOT}: NOT, Logical negation
180 * @code{NULL}: NULL, Function that returns an dissassociated pointer
181 * @code{OR}: OR, Logical inclusive disjunction
182 * @code{PACK}: PACK, Pack an array into an array of rank one
183 * @code{PERROR}: PERROR, Print system error message
184 * @code{PRECISION}: PRECISION, Decimal precision of a real kind
185 * @code{PRESENT}: PRESENT, Determine whether an optional argument is specified
186 * @code{PRODUCT}: PRODUCT, Product of array elements
187 * @code{RADIX}: RADIX, Base of a data model
188 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
189 * @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence
190 * @code{RAND}: RAND, Real pseudo-random number
191 * @code{RANGE}: RANGE, Decimal exponent range of a real kind
192 * @code{RAN}: RAN, Real pseudo-random number
193 * @code{REAL}: REAL, Convert to real type
194 * @code{RENAME}: RENAME, Rename a file
195 * @code{REPEAT}: REPEAT, Repeated string concatenation
196 * @code{RESHAPE}: RESHAPE, Function to reshape an array
197 * @code{RRSPACING}: RRSPACING, Reciprocal of the relative spacing
198 * @code{RSHIFT}: RSHIFT, Right shift bits
199 * @code{SCALE}: SCALE, Scale a real value
200 * @code{SCAN}: SCAN, Scan a string for the presence of a set of characters
201 * @code{SECNDS}: SECNDS, Time function
202 @comment * @code{SECOND}: SECOND, (?)
203 @comment * @code{SECONDS}: SECONDS, (?)
204 * @code{SELECTED_INT_KIND}: SELECTED_INT_KIND, Choose integer kind
205 * @code{SELECTED_REAL_KIND}: SELECTED_REAL_KIND, Choose real kind
206 * @code{SET_EXPONENT}: SET_EXPONENT, Set the exponent of the model
207 * @code{SHAPE}: SHAPE, Determine the shape of an array
208 * @code{SIGN}: SIGN, Sign copying function
209 * @code{SIGNAL}: SIGNAL, Signal handling subroutine (or function)
210 * @code{SIN}: SIN, Sine function
211 * @code{SINH}: SINH, Hyperbolic sine function
212 * @code{SIZE}: SIZE, Function to determine the size of an array
213 * @code{SNGL}: SNGL, Convert double precision real to default real
214 * @code{SPACING}: SPACING, Smallest distance between two numbers of a given type
215 * @code{SPREAD}: SPREAD, Add a dimension to an array
216 * @code{SQRT}: SQRT, Square-root function
217 * @code{SRAND}: SRAND, Reinitialize the random number generator
218 * @code{STAT}: STAT, Get file status
219 * @code{SUM}: SUM, Sum of array elements
220 * @code{SYMLNK}: SYMLNK, Create a symbolic link
221 * @code{SYSTEM}: SYSTEM, Execute a shell command
222 * @code{SYSTEM_CLOCK}: SYSTEM_CLOCK, Time function
223 * @code{TAN}: TAN, Tangent function
224 * @code{TANH}: TANH, Hyperbolic tangent function
225 * @code{TIME}: TIME, Time function
226 * @code{TINY}: TINY, Smallest positive number of a real kind
227 * @code{TRANSFER}: TRANSFER, Transfer bit patterns
228 * @code{TRANSPOSE}: TRANSPOSE, Transpose an array of rank two
229 * @code{TRIM}: TRIM, Function to remove trailing blank characters of a string
230 * @code{UBOUND}: UBOUND, Upper dimension bounds of an array
231 * @code{UMASK}: UMASK, Set the file creation mask
232 * @code{UNLINK}: UNLINK, Remove a file from the file system
233 * @code{UNMASK}: UNMASK, (?)
234 * @code{UNPACK}: UNPACK, Unpack an array of rank one into an array
235 * @code{VERIFY}: VERIFY, Scan a string for the absence of a set of characters
236 * @code{XOR}: XOR, Logical exclusive or
240 @section Introduction to intrinsic procedures
242 Gfortran provides a rich set of intrinsic procedures that includes all
243 the intrinsic procedures required by the Fortran 95 standard, a set of
244 intrinsic procedures for backwards compatibility with Gnu Fortran 77
245 (i.e., @command{g77}), and a small selection of intrinsic procedures
246 from the Fortran 2003 standard. Any description here, which conflicts with a
247 description in either the Fortran 95 standard or the Fortran 2003 standard,
248 is unintentional and the standard(s) should be considered authoritative.
250 The enumeration of the @code{KIND} type parameter is processor defined in
251 the Fortran 95 standard. Gfortran defines the default integer type and
252 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
253 respectively. The standard mandates that both data types shall have
254 another kind, which have more precision. On typical target architectures
255 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
256 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
257 In the description of generic intrinsic procedures, the kind type parameter
258 will be specified by @code{KIND=*}, and in the description of specific
259 names for an intrinsic procedure the kind type parameter will be explicitly
260 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
261 brevity the optional @code{KIND=} syntax will be omitted.
263 Many of the intrinsics procedures take one or more optional arguments.
264 This document follows the convention used in the Fortran 95 standard,
265 and denotes such arguments by square brackets.
267 @command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
268 which can be used to restrict the set of intrinsic procedures to a
269 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
270 option, and so all intrinsic procedures described here are accepted. There
271 is one caveat. For a select group of intrinsic procedures, @command{g77}
272 implemented both a function and a subroutine. Both classes
273 have been implemented in @command{gfortran} for backwards compatibility
274 with @command{g77}. It is noted here that these functions and subroutines
275 cannot be intermixed in a given subprogram. In the descriptions that follow,
276 the applicable option(s) is noted.
281 @section @code{ABORT} --- Abort the program
282 @findex @code{ABORT} intrinsic
286 @item @emph{Description}:
287 @code{ABORT} causes immediate termination of the program. On operating
288 systems that support a core dump, @code{ABORT} will produce a core dump,
289 which is suitable for debugging purposes.
291 @item @emph{Standard}:
295 non-elemental subroutine
300 @item @emph{Return value}:
303 @item @emph{Example}:
306 integer :: i = 1, j = 2
307 if (i /= j) call abort
308 end program test_abort
311 @item @emph{See also}:
312 @ref{EXIT}, @ref{KILL}
319 @section @code{ABS} --- Absolute value
320 @findex @code{ABS} intrinsic
321 @findex @code{CABS} intrinsic
322 @findex @code{DABS} intrinsic
323 @findex @code{IABS} intrinsic
324 @findex @code{ZABS} intrinsic
325 @findex @code{CDABS} intrinsic
326 @cindex absolute value
329 @item @emph{Description}:
330 @code{ABS(X)} computes the absolute value of @code{X}.
332 @item @emph{Standard}:
333 F77 and later, has overloads that are GNU extensions
341 @item @emph{Arguments}:
342 @multitable @columnfractions .15 .80
343 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
344 @code{REAL(*)}, or @code{COMPLEX(*)}.
347 @item @emph{Return value}:
348 The return value is of the same type and
349 kind as the argument except the return value is @code{REAL(*)} for a
350 @code{COMPLEX(*)} argument.
352 @item @emph{Example}:
357 complex :: z = (-1.e0,0.e0)
364 @item @emph{Specific names}:
365 @multitable @columnfractions .20 .20 .20 .40
366 @item Name @tab Argument @tab Return type @tab Standard
367 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab F77 and later
368 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
369 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
370 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
371 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
377 @section @code{ACCESS} --- Checks file access method
378 @findex @code{ACCESS}
379 @cindex file system functions
381 Not yet implemented in gfortran.
384 @item @emph{Description}:
386 @item @emph{Standard}:
391 @item @emph{Arguments}:
392 @item @emph{Return value}:
393 @item @emph{Example}:
394 @item @emph{Specific names}:
395 @item @emph{See also}:
396 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
402 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
403 @findex @code{ACHAR} intrinsic
404 @cindex @acronym{ASCII} collating sequence
407 @item @emph{Description}:
408 @code{ACHAR(I)} returns the character located at position @code{I}
409 in the @acronym{ASCII} collating sequence.
411 @item @emph{Standard}:
420 @item @emph{Arguments}:
421 @multitable @columnfractions .15 .80
422 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
425 @item @emph{Return value}:
426 The return value is of type @code{CHARACTER} with a length of one. The
427 kind type parameter is the same as @code{KIND('A')}.
429 @item @emph{Example}:
434 end program test_achar
441 @section @code{ACOS} --- Arccosine function
442 @findex @code{ACOS} intrinsic
443 @findex @code{DACOS} intrinsic
444 @cindex trigonometric functions (inverse)
447 @item @emph{Description}:
448 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}.
450 @item @emph{Standard}:
459 @item @emph{Arguments}:
460 @multitable @columnfractions .15 .80
461 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
465 @item @emph{Return value}:
466 The return value is of type @code{REAL(*)} and it lies in the
467 range @math{ 0 \leq \arccos (x) \leq \pi}. The kind type
468 parameter is the same as @var{X}.
470 @item @emph{Example}:
473 real(8) :: x = 0.866_8
475 end program test_acos
478 @item @emph{Specific names}:
479 @multitable @columnfractions .20 .20 .20 .40
480 @item Name @tab Argument @tab Return type @tab Standard
481 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
484 @item @emph{See also}:
485 Inverse function: @ref{COS}
491 @section @code{ACOSH} --- Hyperbolic arccosine function
492 @findex @code{ACOSH} intrinsic
493 @cindex hyperbolic arccosine
494 @cindex hyperbolic cosine (inverse)
496 Intrinsic implemented, documentation pending.
499 @item @emph{Description}:
500 @item @emph{Standard}:
503 @item @emph{Arguments}:
504 @item @emph{Return value}:
505 @item @emph{Example}:
506 @item @emph{Specific names}:
507 @item @emph{See also}:
508 Inverse function: @ref{COSH}
514 @section @code{ADJUSTL} --- Left adjust a string
515 @findex @code{ADJUSTL} intrinsic
516 @cindex adjust string
519 @item @emph{Description}:
520 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
521 Spaces are inserted at the end of the string as needed.
523 @item @emph{Standard}:
530 @code{STR = ADJUSTL(STR)}
532 @item @emph{Arguments}:
533 @multitable @columnfractions .15 .80
534 @item @var{STR} @tab The type shall be @code{CHARACTER}.
537 @item @emph{Return value}:
538 The return value is of type @code{CHARACTER} where leading spaces
539 are removed and the same number of spaces are inserted on the end
542 @item @emph{Example}:
545 character(len=20) :: str = ' gfortran'
548 end program test_adjustl
555 @section @code{ADJUSTR} --- Right adjust a string
556 @findex @code{ADJUSTR} intrinsic
557 @cindex adjust string
560 @item @emph{Description}:
561 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
562 Spaces are inserted at the start of the string as needed.
564 @item @emph{Standard}:
571 @code{STR = ADJUSTR(STR)}
573 @item @emph{Arguments}:
574 @multitable @columnfractions .15 .80
575 @item @var{STR} @tab The type shall be @code{CHARACTER}.
578 @item @emph{Return value}:
579 The return value is of type @code{CHARACTER} where trailing spaces
580 are removed and the same number of spaces are inserted at the start
583 @item @emph{Example}:
586 character(len=20) :: str = 'gfortran'
589 end program test_adjustr
596 @section @code{AIMAG} --- Imaginary part of complex number
597 @findex @code{AIMAG} intrinsic
598 @findex @code{DIMAG} intrinsic
599 @findex @code{IMAG} intrinsic
600 @findex @code{IMAGPART} intrinsic
601 @cindex Imaginary part
604 @item @emph{Description}:
605 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
606 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
607 for compatibility with @command{g77}, and their use in new code is
608 strongly discouraged.
610 @item @emph{Standard}:
611 F77 and later, has overloads that are GNU extensions
619 @item @emph{Arguments}:
620 @multitable @columnfractions .15 .80
621 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
624 @item @emph{Return value}:
625 The return value is of type real with the
626 kind type parameter of the argument.
628 @item @emph{Example}:
633 z4 = cmplx(1.e0_4, 0.e0_4)
634 z8 = cmplx(0.e0_8, 1.e0_8)
635 print *, aimag(z4), dimag(z8)
636 end program test_aimag
639 @item @emph{Specific names}:
640 @multitable @columnfractions .20 .20 .20 .40
641 @item Name @tab Argument @tab Return type @tab Standard
642 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab F95 and later
643 @item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
644 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
651 @section @code{AINT} --- Truncate to a whole number
652 @findex @code{AINT} intrinsic
653 @findex @code{DINT} intrinsic
657 @item @emph{Description}:
658 @code{AINT(X [, KIND])} truncates its argument to a whole number.
660 @item @emph{Standard}:
668 @code{X = AINT(X, KIND)}
670 @item @emph{Arguments}:
671 @multitable @columnfractions .15 .80
672 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
673 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
674 initialization expression.
677 @item @emph{Return value}:
678 The return value is of type real with the kind type parameter of the
679 argument if the optional @var{KIND} is absent; otherwise, the kind
680 type parameter will be given by @var{KIND}. If the magnitude of
681 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
682 magnitude is equal to or greater than one, then it returns the largest
683 whole number that does not exceed its magnitude. The sign is the same
684 as the sign of @var{X}.
686 @item @emph{Example}:
693 print *, aint(x4), dint(x8)
695 end program test_aint
698 @item @emph{Specific names}:
699 @multitable @columnfractions .20 .20 .20 .40
700 @item Name @tab Argument @tab Return type @tab Standard
701 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
708 @section @code{ALARM} --- Execute a routine after a given delay
709 @findex @code{ALARM} intrinsic
712 @item @emph{Description}:
713 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
714 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
715 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
716 supplied, it will be returned with the number of seconds remaining until
717 any previously scheduled alarm was due to be delivered, or zero if there
718 was no previously scheduled alarm.
720 @item @emph{Standard}:
727 @code{CALL ALARM(SECONDS, HANDLER)}
728 @code{CALL ALARM(SECONDS, HANDLER, STATUS)}
730 @item @emph{Arguments}:
731 @multitable @columnfractions .15 .80
732 @item @var{SECONDS} @tab The type of the argument shall be a scalar
733 @code{INTEGER}. It is @code{INTENT(IN)}.
734 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
735 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
736 @code{INTEGER}. It is @code{INTENT(IN)}.
737 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
738 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
741 @item @emph{Example}:
744 external handler_print
746 call alarm (3, handler_print, i)
749 end program test_alarm
751 This will cause the external routine @var{handler_print} to be called
758 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
759 @findex @code{ALL} intrinsic
763 @item @emph{Description}:
764 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
765 in the array along dimension @var{DIM}.
767 @item @emph{Standard}:
771 transformational function
775 @code{L = ALL(MASK, DIM)}
777 @item @emph{Arguments}:
778 @multitable @columnfractions .15 .80
779 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
780 it shall not be scalar.
781 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
782 with a value that lies between one and the rank of @var{MASK}.
785 @item @emph{Return value}:
786 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
787 the kind type parameter is the same as the kind type parameter of
788 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
789 an array with the rank of @var{MASK} minus 1. The shape is determined from
790 the shape of @var{MASK} where the @var{DIM} dimension is elided.
794 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
795 It also is true if @var{MASK} has zero size; otherwise, it is false.
797 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
798 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
799 is determined by applying @code{ALL} to the array sections.
802 @item @emph{Example}:
806 l = all((/.true., .true., .true./))
811 integer a(2,3), b(2,3)
815 print *, all(a .eq. b, 1)
816 print *, all(a .eq. b, 2)
817 end subroutine section
825 @section @code{ALLOCATED} --- Status of an allocatable entity
826 @findex @code{ALLOCATED} intrinsic
827 @cindex allocation status
830 @item @emph{Description}:
831 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
833 @item @emph{Standard}:
840 @code{L = ALLOCATED(X)}
842 @item @emph{Arguments}:
843 @multitable @columnfractions .15 .80
844 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
847 @item @emph{Return value}:
848 The return value is a scalar @code{LOGICAL} with the default logical
849 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
850 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
852 @item @emph{Example}:
854 program test_allocated
856 real(4), allocatable :: x(:)
857 if (allocated(x) .eqv. .false.) allocate(x(i))
858 end program test_allocated
864 @section @code{AND} --- Logical and
865 @findex @code{AND} intrinsic
866 @cindex logical operations
868 Intrinsic implemented, documentation pending.
871 @item @emph{Description}:
872 @item @emph{Standard}:
875 @item @emph{Arguments}:
876 @item @emph{Return value}:
877 @item @emph{Example}:
878 @item @emph{Specific names}:
879 @item @emph{See also}:
885 @section @code{ANINT} --- Nearest whole number
886 @findex @code{ANINT} intrinsic
887 @findex @code{DNINT} intrinsic
891 @item @emph{Description}:
892 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
894 @item @emph{Standard}:
902 @code{X = ANINT(X, KIND)}
904 @item @emph{Arguments}:
905 @multitable @columnfractions .15 .80
906 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
907 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
908 initialization expression.
911 @item @emph{Return value}:
912 The return value is of type real with the kind type parameter of the
913 argument if the optional @var{KIND} is absent; otherwise, the kind
914 type parameter will be given by @var{KIND}. If @var{X} is greater than
915 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
916 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
918 @item @emph{Example}:
925 print *, anint(x4), dnint(x8)
927 end program test_anint
930 @item @emph{Specific names}:
931 @multitable @columnfractions .20 .20 .20 .40
932 @item Name @tab Argument @tab Return type @tab Standard
933 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
940 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
941 @findex @code{ANY} intrinsic
945 @item @emph{Description}:
946 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
947 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
949 @item @emph{Standard}:
953 transformational function
957 @code{L = ANY(MASK, DIM)}
959 @item @emph{Arguments}:
960 @multitable @columnfractions .15 .80
961 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
962 it shall not be scalar.
963 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
964 with a value that lies between one and the rank of @var{MASK}.
967 @item @emph{Return value}:
968 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
969 the kind type parameter is the same as the kind type parameter of
970 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
971 an array with the rank of @var{MASK} minus 1. The shape is determined from
972 the shape of @var{MASK} where the @var{DIM} dimension is elided.
976 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
977 otherwise, it is false. It also is false if @var{MASK} has zero size.
979 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
980 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
981 is determined by applying @code{ANY} to the array sections.
984 @item @emph{Example}:
988 l = any((/.true., .true., .true./))
993 integer a(2,3), b(2,3)
997 print *, any(a .eq. b, 1)
998 print *, any(a .eq. b, 2)
999 end subroutine section
1000 end program test_any
1007 @section @code{ASIN} --- Arcsine function
1008 @findex @code{ASIN} intrinsic
1009 @findex @code{DASIN} intrinsic
1010 @cindex trigonometric functions (inverse)
1013 @item @emph{Description}:
1014 @code{ASIN(X)} computes the arcsine of its @var{X}.
1016 @item @emph{Standard}:
1022 @item @emph{Syntax}:
1025 @item @emph{Arguments}:
1026 @multitable @columnfractions .15 .80
1027 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1031 @item @emph{Return value}:
1032 The return value is of type @code{REAL(*)} and it lies in the
1033 range @math{-\pi / 2 \leq \arcsin (x) \leq \pi / 2}. The kind type
1034 parameter is the same as @var{X}.
1036 @item @emph{Example}:
1039 real(8) :: x = 0.866_8
1041 end program test_asin
1044 @item @emph{Specific names}:
1045 @multitable @columnfractions .20 .20 .20 .40
1046 @item Name @tab Argument @tab Return type @tab Standard
1047 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1050 @item @emph{See also}:
1051 Inverse function: @ref{SIN}
1057 @section @code{ASINH} --- Hyperbolic arcsine function
1058 @findex @code{ASINH} intrinsic
1059 @cindex hyperbolic arcsine
1060 @cindex hyperbolic sine (inverse)
1062 Intrinsic implemented, documentation pending.
1065 @item @emph{Description}:
1066 @item @emph{Standard}:
1068 @item @emph{Syntax}:
1069 @item @emph{Arguments}:
1070 @item @emph{Return value}:
1071 @item @emph{Example}:
1072 @item @emph{Specific names}:
1073 @item @emph{See also}:
1079 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
1080 @findex @code{ASSOCIATED} intrinsic
1081 @cindex pointer status
1084 @item @emph{Description}:
1085 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1086 or if @var{PTR} is associated with the target @var{TGT}.
1088 @item @emph{Standard}:
1094 @item @emph{Syntax}:
1095 @code{L = ASSOCIATED(PTR)}
1096 @code{L = ASSOCIATED(PTR [, TGT])}
1098 @item @emph{Arguments}:
1099 @multitable @columnfractions .15 .80
1100 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1101 it can be of any type.
1102 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1103 a @code{TARGET}. It must have the same type, kind type parameter, and
1104 array rank as @var{PTR}.
1106 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1108 @item @emph{Return value}:
1109 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1110 There are several cases:
1112 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1113 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1114 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1116 is not a 0 sized storage sequence and the target associated with @var{PTR}
1117 occupies the same storage units. If @var{PTR} is disassociated, then the
1119 @item (C) If @var{TGT} is present and an array target, the result is true if
1120 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1121 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1122 @var{PTR} occupy the same storage units in array element order.
1123 As in case(B), the result is false, if @var{PTR} is disassociated.
1124 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1125 target associated with @var{PTR} and the target associated with @var{TGT}
1126 are not 0 sized storage sequences and occupy the same storage units.
1127 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1128 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1129 target associated with @var{PTR} and the target associated with @var{TGT}
1130 have the same shape, are not 0 sized arrays, are arrays whose elements are
1131 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1132 storage units in array element order.
1133 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1136 @item @emph{Example}:
1138 program test_associated
1140 real, target :: tgt(2) = (/1., 2./)
1141 real, pointer :: ptr(:)
1143 if (associated(ptr) .eqv. .false.) call abort
1144 if (associated(ptr,tgt) .eqv. .false.) call abort
1145 end program test_associated
1148 @item @emph{See also}:
1155 @section @code{ATAN} --- Arctangent function
1156 @findex @code{ATAN} intrinsic
1157 @findex @code{DATAN} intrinsic
1158 @cindex trigonometric functions (inverse)
1161 @item @emph{Description}:
1162 @code{ATAN(X)} computes the arctangent of @var{X}.
1164 @item @emph{Standard}:
1170 @item @emph{Syntax}:
1173 @item @emph{Arguments}:
1174 @multitable @columnfractions .15 .80
1175 @item @var{X} @tab The type shall be @code{REAL(*)}.
1178 @item @emph{Return value}:
1179 The return value is of type @code{REAL(*)} and it lies in the
1180 range @math{ - \pi / 2 \leq \arcsin (x) \leq \pi / 2}.
1182 @item @emph{Example}:
1185 real(8) :: x = 2.866_8
1187 end program test_atan
1190 @item @emph{Specific names}:
1191 @multitable @columnfractions .20 .20 .20 .40
1192 @item Name @tab Argument @tab Return type @tab Standard
1193 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1196 @item @emph{See also}:
1197 Inverse function: @ref{TAN}
1204 @section @code{ATAN2} --- Arctangent function
1205 @findex @code{ATAN2} intrinsic
1206 @findex @code{DATAN2} intrinsic
1207 @cindex trigonometric functions (inverse)
1210 @item @emph{Description}:
1211 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1213 @item @emph{Standard}:
1219 @item @emph{Syntax}:
1220 @code{X = ATAN2(Y,X)}
1222 @item @emph{Arguments}:
1223 @multitable @columnfractions .15 .80
1224 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1225 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1226 If @var{Y} is zero, then @var{X} must be nonzero.
1229 @item @emph{Return value}:
1230 The return value has the same type and kind type parameter as @var{Y}.
1231 It is the principal value of the complex number @math{X + i Y}. If
1232 @var{X} is nonzero, then it lies in the range @math{-\pi \le \arccos (x) \leq \pi}.
1233 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
1234 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1235 is negative. Finally, if @var{X} is zero, then the magnitude of the result
1238 @item @emph{Example}:
1241 real(4) :: x = 1.e0_4, y = 0.5e0_4
1243 end program test_atan2
1246 @item @emph{Specific names}:
1247 @multitable @columnfractions .20 .20 .20 .40
1248 @item Name @tab Argument @tab Return type @tab Standard
1249 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1256 @section @code{ATANH} --- Hyperbolic arctangent function
1257 @findex @code{ASINH} intrinsic
1258 @cindex hyperbolic arctangent
1259 @cindex hyperbolic tangent (inverse)
1261 Intrinsic implemented, documentation pending.
1264 @item @emph{Description}:
1265 @item @emph{Standard}:
1267 @item @emph{Syntax}:
1268 @item @emph{Arguments}:
1269 @item @emph{Return value}:
1270 @item @emph{Example}:
1271 @item @emph{Specific names}:
1272 @item @emph{See also}:
1279 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1280 @findex @code{BESJ0} intrinsic
1281 @findex @code{DBESJ0} intrinsic
1285 @item @emph{Description}:
1286 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1289 @item @emph{Standard}:
1295 @item @emph{Syntax}:
1298 @item @emph{Arguments}:
1299 @multitable @columnfractions .15 .80
1300 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1303 @item @emph{Return value}:
1304 The return value is of type @code{REAL(*)} and it lies in the
1305 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1307 @item @emph{Example}:
1310 real(8) :: x = 0.0_8
1312 end program test_besj0
1315 @item @emph{Specific names}:
1316 @multitable @columnfractions .20 .20 .20 .40
1317 @item Name @tab Argument @tab Return type @tab Standard
1318 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1325 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1326 @findex @code{BESJ1} intrinsic
1327 @findex @code{DBESJ1} intrinsic
1331 @item @emph{Description}:
1332 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1335 @item @emph{Standard}:
1341 @item @emph{Syntax}:
1344 @item @emph{Arguments}:
1345 @multitable @columnfractions .15 .80
1346 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1349 @item @emph{Return value}:
1350 The return value is of type @code{REAL(*)} and it lies in the
1351 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1353 @item @emph{Example}:
1356 real(8) :: x = 1.0_8
1358 end program test_besj1
1361 @item @emph{Specific names}:
1362 @multitable @columnfractions .20 .20 .20 .40
1363 @item Name @tab Argument @tab Return type @tab Standard
1364 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1371 @section @code{BESJN} --- Bessel function of the first kind
1372 @findex @code{BESJN} intrinsic
1373 @findex @code{DBESJN} intrinsic
1377 @item @emph{Description}:
1378 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1381 @item @emph{Standard}:
1387 @item @emph{Syntax}:
1388 @code{Y = BESJN(N, X)}
1390 @item @emph{Arguments}:
1391 @multitable @columnfractions .15 .80
1392 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1393 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1396 @item @emph{Return value}:
1397 The return value is a scalar of type @code{REAL(*)}.
1399 @item @emph{Example}:
1402 real(8) :: x = 1.0_8
1404 end program test_besjn
1407 @item @emph{Specific names}:
1408 @multitable @columnfractions .20 .20 .20 .40
1409 @item Name @tab Argument @tab Return type @tab Standard
1410 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1411 @item @tab @code{REAL(8) X} @tab @tab
1418 @section @code{BESY0} --- Bessel function of the second kind of order 0
1419 @findex @code{BESY0} intrinsic
1420 @findex @code{DBESY0} intrinsic
1424 @item @emph{Description}:
1425 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1428 @item @emph{Standard}:
1434 @item @emph{Syntax}:
1437 @item @emph{Arguments}:
1438 @multitable @columnfractions .15 .80
1439 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1442 @item @emph{Return value}:
1443 The return value is a scalar of type @code{REAL(*)}.
1445 @item @emph{Example}:
1448 real(8) :: x = 0.0_8
1450 end program test_besy0
1453 @item @emph{Specific names}:
1454 @multitable @columnfractions .20 .20 .20 .40
1455 @item Name @tab Argument @tab Return type @tab Standard
1456 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1463 @section @code{BESY1} --- Bessel function of the second kind of order 1
1464 @findex @code{BESY1} intrinsic
1465 @findex @code{DBESY1} intrinsic
1469 @item @emph{Description}:
1470 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1473 @item @emph{Standard}:
1479 @item @emph{Syntax}:
1482 @item @emph{Arguments}:
1483 @multitable @columnfractions .15 .80
1484 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1487 @item @emph{Return value}:
1488 The return value is a scalar of type @code{REAL(*)}.
1490 @item @emph{Example}:
1493 real(8) :: x = 1.0_8
1495 end program test_besy1
1498 @item @emph{Specific names}:
1499 @multitable @columnfractions .20 .20 .20 .40
1500 @item Name @tab Argument @tab Return type @tab Standard
1501 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1508 @section @code{BESYN} --- Bessel function of the second kind
1509 @findex @code{BESYN} intrinsic
1510 @findex @code{DBESYN} intrinsic
1514 @item @emph{Description}:
1515 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1518 @item @emph{Standard}:
1524 @item @emph{Syntax}:
1525 @code{Y = BESYN(N, X)}
1527 @item @emph{Arguments}:
1528 @multitable @columnfractions .15 .80
1529 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1530 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1533 @item @emph{Return value}:
1534 The return value is a scalar of type @code{REAL(*)}.
1536 @item @emph{Example}:
1539 real(8) :: x = 1.0_8
1541 end program test_besyn
1544 @item @emph{Specific names}:
1545 @multitable @columnfractions .20 .20 .20 .40
1546 @item Name @tab Argument @tab Return type @tab Standard
1547 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1548 @item @tab @code{REAL(8) X} @tab @tab
1555 @section @code{BIT_SIZE} --- Bit size inquiry function
1556 @findex @code{BIT_SIZE} intrinsic
1560 @item @emph{Description}:
1561 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1562 represented by the type of @var{I}.
1564 @item @emph{Standard}:
1570 @item @emph{Syntax}:
1571 @code{I = BIT_SIZE(I)}
1573 @item @emph{Arguments}:
1574 @multitable @columnfractions .15 .80
1575 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1578 @item @emph{Return value}:
1579 The return value is of type @code{INTEGER(*)}
1581 @item @emph{Example}:
1583 program test_bit_size
1588 end program test_bit_size
1595 @section @code{BTEST} --- Bit test function
1596 @findex @code{BTEST} intrinsic
1600 @item @emph{Description}:
1601 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1604 @item @emph{Standard}:
1610 @item @emph{Syntax}:
1611 @code{I = BTEST(I,POS)}
1613 @item @emph{Arguments}:
1614 @multitable @columnfractions .15 .80
1615 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1616 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1619 @item @emph{Return value}:
1620 The return value is of type @code{LOGICAL}
1622 @item @emph{Example}:
1625 integer :: i = 32768 + 1024 + 64
1629 bool = btest(i, pos)
1632 end program test_btest
1639 @section @code{CEILING} --- Integer ceiling function
1640 @findex @code{CEILING} intrinsic
1644 @item @emph{Description}:
1645 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1647 @item @emph{Standard}:
1653 @item @emph{Syntax}:
1654 @code{I = CEILING(X[,KIND])}
1656 @item @emph{Arguments}:
1657 @multitable @columnfractions .15 .80
1658 @item @var{X} @tab The type shall be @code{REAL(*)}.
1659 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1662 @item @emph{Return value}:
1663 The return value is of type @code{INTEGER(KIND)}
1665 @item @emph{Example}:
1667 program test_ceiling
1670 print *, ceiling(x) ! returns 64
1671 print *, ceiling(y) ! returns -63
1672 end program test_ceiling
1675 @item @emph{See also}:
1676 @ref{FLOOR}, @ref{NINT}
1683 @section @code{CHAR} --- Character conversion function
1684 @findex @code{CHAR} intrinsic
1685 @cindex conversion function (character)
1688 @item @emph{Description}:
1689 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1691 @item @emph{Standard}:
1697 @item @emph{Syntax}:
1698 @code{C = CHAR(I[,KIND])}
1700 @item @emph{Arguments}:
1701 @multitable @columnfractions .15 .80
1702 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1703 @item @var{KIND} @tab Optional scaler integer initialization expression.
1706 @item @emph{Return value}:
1707 The return value is of type @code{CHARACTER(1)}
1709 @item @emph{Example}:
1715 print *, i, c ! returns 'J'
1716 end program test_char
1719 @item @emph{See also}:
1720 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1726 @section @code{CHDIR} --- Change working directory
1727 @findex @code{CHDIR} intrinsic
1728 @cindex file system functions
1730 Intrinsic implemented, documentation pending.
1733 @item @emph{Description}:
1734 @item @emph{Standard}:
1736 @item @emph{Syntax}:
1737 @item @emph{Arguments}:
1738 @item @emph{Return value}:
1739 @item @emph{Example}:
1740 @item @emph{Specific names}:
1741 @item @emph{See also}:
1746 @section @code{CHMOD} --- Change access permissions of files
1747 @findex @code{CHMOD}
1748 @cindex file system functions
1750 Not yet implemented in gfortran.
1753 @item @emph{Description}:
1755 @item @emph{Standard}:
1761 @item @emph{Syntax}:
1762 @item @emph{Arguments}:
1763 @item @emph{Return value}:
1764 @item @emph{Example}:
1765 @item @emph{Specific names}:
1766 @item @emph{See also}:
1767 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
1773 @section @code{CMPLX} --- Complex conversion function
1774 @findex @code{CMPLX} intrinsic
1778 @item @emph{Description}:
1779 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1780 the real component. If @var{Y} is present it is converted to the imaginary
1781 component. If @var{Y} is not present then the imaginary component is set to
1782 0.0. If @var{X} is complex then @var{Y} must not be present.
1784 @item @emph{Standard}:
1790 @item @emph{Syntax}:
1791 @code{C = CMPLX(X[,Y[,KIND]])}
1793 @item @emph{Arguments}:
1794 @multitable @columnfractions .15 .80
1795 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1796 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1797 @item @var{KIND} @tab Optional scaler integer initialization expression.
1800 @item @emph{Return value}:
1801 The return value is of type @code{COMPLEX(*)}
1803 @item @emph{Example}:
1810 print *, z, cmplx(x)
1811 end program test_cmplx
1817 @node COMMAND_ARGUMENT_COUNT
1818 @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function
1819 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1820 @cindex command argument count
1823 @item @emph{Description}:
1824 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1825 command line when the containing program was invoked.
1827 @item @emph{Standard}:
1833 @item @emph{Syntax}:
1834 @code{I = COMMAND_ARGUMENT_COUNT()}
1836 @item @emph{Arguments}:
1837 @multitable @columnfractions .15 .80
1841 @item @emph{Return value}:
1842 The return value is of type @code{INTEGER(4)}
1844 @item @emph{Example}:
1846 program test_command_argument_count
1848 count = command_argument_count()
1850 end program test_command_argument_count
1857 @section @code{CONJG} --- Complex conjugate function
1858 @findex @code{CONJG} intrinsic
1859 @findex @code{DCONJG} intrinsic
1860 @cindex complex conjugate
1862 @item @emph{Description}:
1863 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
1864 then the result is @code{(x, -y)}
1866 @item @emph{Standard}:
1867 F77 and later, has overloads that are GNU extensions
1872 @item @emph{Syntax}:
1875 @item @emph{Arguments}:
1876 @multitable @columnfractions .15 .80
1877 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
1880 @item @emph{Return value}:
1881 The return value is of type @code{COMPLEX(*)}.
1883 @item @emph{Example}:
1886 complex :: z = (2.0, 3.0)
1887 complex(8) :: dz = (2.71_8, -3.14_8)
1892 end program test_conjg
1895 @item @emph{Specific names}:
1896 @multitable @columnfractions .20 .20 .20 .40
1897 @item Name @tab Argument @tab Return type @tab Standard
1898 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
1905 @section @code{COS} --- Cosine function
1906 @findex @code{COS} intrinsic
1907 @findex @code{DCOS} intrinsic
1908 @findex @code{ZCOS} intrinsic
1909 @findex @code{CDCOS} intrinsic
1910 @cindex trigonometric functions
1913 @item @emph{Description}:
1914 @code{COS(X)} computes the cosine of @var{X}.
1916 @item @emph{Standard}:
1917 F77 and later, has overloads that are GNU extensions
1922 @item @emph{Syntax}:
1925 @item @emph{Arguments}:
1926 @multitable @columnfractions .15 .80
1927 @item @var{X} @tab The type shall be @code{REAL(*)} or
1931 @item @emph{Return value}:
1932 The return value is of type @code{REAL(*)} and it lies in the
1933 range @math{ -1 \leq \cos (x) \leq 1}. The kind type
1934 parameter is the same as @var{X}.
1936 @item @emph{Example}:
1941 end program test_cos
1944 @item @emph{Specific names}:
1945 @multitable @columnfractions .20 .20 .20 .40
1946 @item Name @tab Argument @tab Return type @tab Standard
1947 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1948 @item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
1949 @item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
1950 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
1953 @item @emph{See also}:
1954 Inverse function: @ref{ACOS}
1961 @section @code{COSH} --- Hyperbolic cosine function
1962 @findex @code{COSH} intrinsic
1963 @findex @code{DCOSH} intrinsic
1964 @cindex hyperbolic cosine
1967 @item @emph{Description}:
1968 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
1970 @item @emph{Standard}:
1976 @item @emph{Syntax}:
1979 @item @emph{Arguments}:
1980 @multitable @columnfractions .15 .80
1981 @item @var{X} @tab The type shall be @code{REAL(*)}.
1984 @item @emph{Return value}:
1985 The return value is of type @code{REAL(*)} and it is positive
1986 (@math{ \cosh (x) \geq 0 }.
1988 @item @emph{Example}:
1991 real(8) :: x = 1.0_8
1993 end program test_cosh
1996 @item @emph{Specific names}:
1997 @multitable @columnfractions .20 .20 .20 .40
1998 @item Name @tab Argument @tab Return type @tab Standard
1999 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2002 @item @emph{See also}:
2003 Inverse function: @ref{ACOSH}
2010 @section @code{COUNT} --- Count function
2011 @findex @code{COUNT} intrinsic
2015 @item @emph{Description}:
2016 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2017 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2018 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2019 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2021 @item @emph{Standard}:
2025 transformational function
2027 @item @emph{Syntax}:
2028 @code{I = COUNT(MASK[,DIM])}
2030 @item @emph{Arguments}:
2031 @multitable @columnfractions .15 .80
2032 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2033 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2036 @item @emph{Return value}:
2037 The return value is of type @code{INTEGER} with rank equal to that of
2040 @item @emph{Example}:
2043 integer, dimension(2,3) :: a, b
2044 logical, dimension(2,3) :: mask
2045 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2046 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2047 print '(3i3)', a(1,:)
2048 print '(3i3)', a(2,:)
2050 print '(3i3)', b(1,:)
2051 print '(3i3)', b(2,:)
2054 print '(3l3)', mask(1,:)
2055 print '(3l3)', mask(2,:)
2057 print '(3i3)', count(mask)
2059 print '(3i3)', count(mask, 1)
2061 print '(3i3)', count(mask, 2)
2062 end program test_count
2069 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2070 @findex @code{CPU_TIME} intrinsic
2074 @item @emph{Description}:
2075 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
2076 is useful for testing segments of code to determine execution time.
2078 @item @emph{Standard}:
2084 @item @emph{Syntax}:
2087 @item @emph{Arguments}:
2088 @multitable @columnfractions .15 .80
2089 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2092 @item @emph{Return value}:
2095 @item @emph{Example}:
2097 program test_cpu_time
2098 real :: start, finish
2099 call cpu_time(start)
2100 ! put code to test here
2101 call cpu_time(finish)
2102 print '("Time = ",f6.3," seconds.")',finish-start
2103 end program test_cpu_time
2110 @section @code{CSHIFT} --- Circular shift function
2111 @findex @code{CSHIFT} intrinsic
2112 @cindex bit manipulation
2115 @item @emph{Description}:
2116 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2117 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2118 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2119 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2120 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2121 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
2122 sections of @var{ARRAY} along the given dimension are shifted. Elements
2123 shifted out one end of each rank one section are shifted back in the other end.
2125 @item @emph{Standard}:
2129 transformational function
2131 @item @emph{Syntax}:
2132 @code{A = CSHIFT(A, SHIFT[,DIM])}
2134 @item @emph{Arguments}:
2135 @multitable @columnfractions .15 .80
2136 @item @var{ARRAY} @tab May be any type, not scaler.
2137 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2138 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2141 @item @emph{Return value}:
2142 Returns an array of same type and rank as the @var{ARRAY} argument.
2144 @item @emph{Example}:
2147 integer, dimension(3,3) :: a
2148 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2149 print '(3i3)', a(1,:)
2150 print '(3i3)', a(2,:)
2151 print '(3i3)', a(3,:)
2152 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2154 print '(3i3)', a(1,:)
2155 print '(3i3)', a(2,:)
2156 print '(3i3)', a(3,:)
2157 end program test_cshift
2163 @section @code{CTIME} --- Convert a time into a string
2164 @findex @code{CTIME} intrinsic
2165 @cindex ctime subroutine
2168 @item @emph{Description}:
2169 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2170 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2171 1995}, and returns that string into @var{S}.
2173 If @code{CTIME} is invoked as a function, it can not be invoked as a
2174 subroutine, and vice versa.
2176 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2177 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2179 @item @emph{Standard}:
2185 @item @emph{Syntax}:
2186 @multitable @columnfractions .80
2187 @item @code{CALL CTIME(T,S)}.
2188 @item @code{S = CTIME(T)}, (not recommended).
2191 @item @emph{Arguments}:
2192 @multitable @columnfractions .15 .80
2193 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2194 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2197 @item @emph{Return value}:
2198 The converted date and time as a string.
2200 @item @emph{Example}:
2204 character(len=30) :: date
2207 ! Do something, main part of the program
2210 print *, 'Program was started on ', date
2211 end program test_ctime
2216 @section @code{DATE_AND_TIME} --- Date and time subroutine
2217 @findex @code{DATE_AND_TIME} intrinsic
2218 @cindex DATE_AND_TIME
2221 @item @emph{Description}:
2222 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2223 time information from the real-time system clock. @var{DATE} is
2224 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
2225 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2226 representing the difference with respect to Coordinated Universal Time (UTC).
2227 Unavailable time and date parameters return blanks.
2229 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2231 @multitable @columnfractions .15 .30 .60
2232 @item @tab @code{VALUE(1)}: @tab The year
2233 @item @tab @code{VALUE(2)}: @tab The month
2234 @item @tab @code{VALUE(3)}: @tab The day of the month
2235 @item @tab @code{VAlUE(4)}: @tab Time difference with UTC in minutes
2236 @item @tab @code{VALUE(5)}: @tab The hour of the day
2237 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2238 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2239 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2242 @item @emph{Standard}:
2248 @item @emph{Syntax}:
2249 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2251 @item @emph{Arguments}:
2252 @multitable @columnfractions .15 .80
2253 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2254 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2255 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2256 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2259 @item @emph{Return value}:
2262 @item @emph{Example}:
2264 program test_time_and_date
2265 character(8) :: date
2266 character(10) :: time
2267 character(5) :: zone
2268 integer,dimension(8) :: values
2269 ! using keyword arguments
2270 call date_and_time(date,time,zone,values)
2271 call date_and_time(DATE=date,ZONE=zone)
2272 call date_and_time(TIME=time)
2273 call date_and_time(VALUES=values)
2274 print '(a,2x,a,2x,a)', date, time, zone
2275 print '(8i5))', values
2276 end program test_time_and_date
2283 @section @code{DBLE} --- Double conversion function
2284 @findex @code{DBLE} intrinsic
2285 @cindex double conversion
2288 @item @emph{Description}:
2289 @code{DBLE(X)} Converts @var{X} to double precision real type.
2291 @item @emph{Standard}:
2297 @item @emph{Syntax}:
2300 @item @emph{Arguments}:
2301 @multitable @columnfractions .15 .80
2302 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2305 @item @emph{Return value}:
2306 The return value is of type double precision real.
2308 @item @emph{Example}:
2313 complex :: z = (2.3,1.14)
2314 print *, dble(x), dble(i), dble(z)
2315 end program test_dble
2318 @item @emph{See also}:
2319 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2325 @section @code{DCMPLX} --- Double complex conversion function
2326 @findex @code{DCMPLX} intrinsic
2330 @item @emph{Description}:
2331 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2332 converted to the real component. If @var{Y} is present it is converted to the
2333 imaginary component. If @var{Y} is not present then the imaginary component is
2334 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
2336 @item @emph{Standard}:
2342 @item @emph{Syntax}:
2343 @code{C = DCMPLX(X)}
2344 @code{C = DCMPLX(X,Y)}
2346 @item @emph{Arguments}:
2347 @multitable @columnfractions .15 .80
2348 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2349 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
2352 @item @emph{Return value}:
2353 The return value is of type @code{COMPLEX(8)}
2355 @item @emph{Example}:
2365 print *, dcmplx(x,i)
2366 end program test_dcmplx
2373 @section @code{DFLOAT} --- Double conversion function
2374 @findex @code{DFLOAT} intrinsic
2375 @cindex double float conversion
2378 @item @emph{Description}:
2379 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2381 @item @emph{Standard}:
2387 @item @emph{Syntax}:
2388 @code{X = DFLOAT(X)}
2390 @item @emph{Arguments}:
2391 @multitable @columnfractions .15 .80
2392 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2395 @item @emph{Return value}:
2396 The return value is of type double precision real.
2398 @item @emph{Example}:
2403 end program test_dfloat
2406 @item @emph{See also}:
2407 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2413 @section @code{DIGITS} --- Significant digits function
2414 @findex @code{DIGITS} intrinsic
2415 @cindex digits, significant
2418 @item @emph{Description}:
2419 @code{DIGITS(X)} returns the number of significant digits of the internal model
2420 representation of @var{X}. For example, on a system using a 32-bit
2421 floating point representation, a default real number would likely return 24.
2423 @item @emph{Standard}:
2429 @item @emph{Syntax}:
2430 @code{C = DIGITS(X)}
2432 @item @emph{Arguments}:
2433 @multitable @columnfractions .15 .80
2434 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2437 @item @emph{Return value}:
2438 The return value is of type @code{INTEGER}.
2440 @item @emph{Example}:
2443 integer :: i = 12345
2449 end program test_digits
2456 @section @code{DIM} --- Dim function
2457 @findex @code{DIM} intrinsic
2458 @findex @code{IDIM} intrinsic
2459 @findex @code{DDIM} intrinsic
2463 @item @emph{Description}:
2464 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2465 otherwise returns zero.
2467 @item @emph{Standard}:
2473 @item @emph{Syntax}:
2476 @item @emph{Arguments}:
2477 @multitable @columnfractions .15 .80
2478 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2479 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2482 @item @emph{Return value}:
2483 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2485 @item @emph{Example}:
2491 x = dim(4.345_8, 2.111_8)
2494 end program test_dim
2497 @item @emph{Specific names}:
2498 @multitable @columnfractions .20 .20 .20 .40
2499 @item Name @tab Argument @tab Return type @tab Standard
2500 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2501 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab F77 and later
2508 @section @code{DOT_PRODUCT} --- Dot product function
2509 @findex @code{DOT_PRODUCT} intrinsic
2513 @item @emph{Description}:
2514 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2515 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2516 and must be arrays of rank one and of equal size. If the vectors are
2517 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2518 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2519 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2521 @item @emph{Standard}:
2525 transformational function
2527 @item @emph{Syntax}:
2528 @code{S = DOT_PRODUCT(X,Y)}
2530 @item @emph{Arguments}:
2531 @multitable @columnfractions .15 .80
2532 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2533 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2536 @item @emph{Return value}:
2537 If the arguments are numeric, the return value is a scaler of numeric type,
2538 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2539 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2541 @item @emph{Example}:
2543 program test_dot_prod
2544 integer, dimension(3) :: a, b
2551 print *, dot_product(a,b)
2552 end program test_dot_prod
2559 @section @code{DPROD} --- Double product function
2560 @findex @code{DPROD} intrinsic
2561 @cindex Double product
2564 @item @emph{Description}:
2565 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2567 @item @emph{Standard}:
2573 @item @emph{Syntax}:
2574 @code{D = DPROD(X,Y)}
2576 @item @emph{Arguments}:
2577 @multitable @columnfractions .15 .80
2578 @item @var{X} @tab The type shall be @code{REAL}.
2579 @item @var{Y} @tab The type shall be @code{REAL}.
2582 @item @emph{Return value}:
2583 The return value is of type @code{REAL(8)}.
2585 @item @emph{Example}:
2594 end program test_dprod
2601 @section @code{DREAL} --- Double real part function
2602 @findex @code{DREAL} intrinsic
2603 @cindex Double real part
2606 @item @emph{Description}:
2607 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2609 @item @emph{Standard}:
2615 @item @emph{Syntax}:
2618 @item @emph{Arguments}:
2619 @multitable @columnfractions .15 .80
2620 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2623 @item @emph{Return value}:
2624 The return value is of type @code{REAL(8)}.
2626 @item @emph{Example}:
2629 complex(8) :: z = (1.3_8,7.2_8)
2631 end program test_dreal
2634 @item @emph{See also}:
2642 @section @code{DTIME} --- Execution time subroutine (or function)
2643 @findex @code{DTIME} intrinsic
2644 @cindex dtime subroutine
2647 @item @emph{Description}:
2648 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2649 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2650 returns the user and system components of this time in @code{TARRAY(1)} and
2651 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2654 Subsequent invocations of @code{DTIME} return values accumulated since the
2655 previous invocation.
2657 On some systems, the underlying timings are represented using types with
2658 sufficiently small limits that overflows (wraparounds) are possible, such as
2659 32-bit types. Therefore, the values returned by this intrinsic might be, or
2660 become, negative, or numerically less than previous values, during a single
2661 run of the compiled program.
2663 If @code{DTIME} is invoked as a function, it can not be invoked as a
2664 subroutine, and vice versa.
2666 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2668 @multitable @columnfractions .15 .30 .60
2669 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2670 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2671 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2674 @item @emph{Standard}:
2680 @item @emph{Syntax}:
2681 @multitable @columnfractions .80
2682 @item @code{CALL DTIME(TARRAY, RESULT)}.
2683 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2686 @item @emph{Arguments}:
2687 @multitable @columnfractions .15 .80
2688 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2689 @item @var{RESULT}@tab The type shall be @code{REAL}.
2692 @item @emph{Return value}:
2693 Elapsed time in seconds since the start of program execution.
2695 @item @emph{Example}:
2699 real, dimension(2) :: tarray
2701 call dtime(tarray, result)
2705 do i=1,100000000 ! Just a delay
2708 call dtime(tarray, result)
2712 end program test_dtime
2719 @section @code{EOSHIFT} --- End-off shift function
2720 @findex @code{EOSHIFT} intrinsic
2721 @cindex bit manipulation
2724 @item @emph{Description}:
2725 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2726 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2727 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2728 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2729 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2730 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2731 then all complete rank one sections of @var{ARRAY} along the given dimension are
2732 shifted. Elements shifted out one end of each rank one section are dropped. If
2733 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2734 is copied back in the other end. If @var{BOUNDARY} is not present then the
2735 following are copied in depending on the type of @var{ARRAY}.
2737 @multitable @columnfractions .15 .80
2738 @item @emph{Array Type} @tab @emph{Boundary Value}
2739 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2740 @item Logical @tab @code{.FALSE.}.
2741 @item Character(@var{len}) @tab @var{len} blanks.
2744 @item @emph{Standard}:
2748 transformational function
2750 @item @emph{Syntax}:
2751 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2753 @item @emph{Arguments}:
2754 @multitable @columnfractions .15 .80
2755 @item @var{ARRAY} @tab May be any type, not scaler.
2756 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2757 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2758 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2761 @item @emph{Return value}:
2762 Returns an array of same type and rank as the @var{ARRAY} argument.
2764 @item @emph{Example}:
2766 program test_eoshift
2767 integer, dimension(3,3) :: a
2768 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2769 print '(3i3)', a(1,:)
2770 print '(3i3)', a(2,:)
2771 print '(3i3)', a(3,:)
2772 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2774 print '(3i3)', a(1,:)
2775 print '(3i3)', a(2,:)
2776 print '(3i3)', a(3,:)
2777 end program test_eoshift
2784 @section @code{EPSILON} --- Epsilon function
2785 @findex @code{EPSILON} intrinsic
2786 @cindex epsilon, significant
2789 @item @emph{Description}:
2790 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2792 @item @emph{Standard}:
2798 @item @emph{Syntax}:
2799 @code{C = EPSILON(X)}
2801 @item @emph{Arguments}:
2802 @multitable @columnfractions .15 .80
2803 @item @var{X} @tab The type shall be @code{REAL(*)}.
2806 @item @emph{Return value}:
2807 The return value is of same type as the argument.
2809 @item @emph{Example}:
2811 program test_epsilon
2816 end program test_epsilon
2823 @section @code{EQV} --- Logical equivalence
2824 @findex @code{EQV} intrinsic
2825 @cindex logical operations
2827 Intrinsic implemented, documentation pending.
2830 @item @emph{Description}:
2831 @item @emph{Standard}:
2835 @item @emph{Syntax}:
2836 @item @emph{Arguments}:
2837 @item @emph{Return value}:
2838 @item @emph{Example}:
2839 @item @emph{Specific names}:
2840 @item @emph{See also}:
2847 @section @code{ERF} --- Error function
2848 @findex @code{ERF} intrinsic
2849 @cindex error function
2852 @item @emph{Description}:
2853 @code{ERF(X)} computes the error function of @var{X}.
2855 @item @emph{Standard}:
2861 @item @emph{Syntax}:
2864 @item @emph{Arguments}:
2865 @multitable @columnfractions .15 .80
2866 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2869 @item @emph{Return value}:
2870 The return value is a scalar of type @code{REAL(*)} and it is positive
2871 (@math{ - 1 \leq erf (x) \leq 1 }.
2873 @item @emph{Example}:
2876 real(8) :: x = 0.17_8
2878 end program test_erf
2881 @item @emph{Specific names}:
2882 @multitable @columnfractions .20 .20 .20 .40
2883 @item Name @tab Argument @tab Return type @tab Standard
2884 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
2891 @section @code{ERFC} --- Error function
2892 @findex @code{ERFC} intrinsic
2893 @cindex error function
2896 @item @emph{Description}:
2897 @code{ERFC(X)} computes the complementary error function of @var{X}.
2899 @item @emph{Standard}:
2905 @item @emph{Syntax}:
2908 @item @emph{Arguments}:
2909 @multitable @columnfractions .15 .80
2910 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2913 @item @emph{Return value}:
2914 The return value is a scalar of type @code{REAL(*)} and it is positive
2915 (@math{ 0 \leq erfc (x) \leq 2 }.
2917 @item @emph{Example}:
2920 real(8) :: x = 0.17_8
2922 end program test_erfc
2925 @item @emph{Specific names}:
2926 @multitable @columnfractions .20 .20 .20 .40
2927 @item Name @tab Argument @tab Return type @tab Standard
2928 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
2935 @section @code{ETIME} --- Execution time subroutine (or function)
2936 @findex @code{ETIME} intrinsic
2937 @cindex time functions
2940 @item @emph{Description}:
2941 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
2942 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2943 returns the user and system components of this time in @code{TARRAY(1)} and
2944 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
2946 On some systems, the underlying timings are represented using types with
2947 sufficiently small limits that overflows (wraparounds) are possible, such as
2948 32-bit types. Therefore, the values returned by this intrinsic might be, or
2949 become, negative, or numerically less than previous values, during a single
2950 run of the compiled program.
2952 If @code{ETIME} is invoked as a function, it can not be invoked as a
2953 subroutine, and vice versa.
2955 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2957 @multitable @columnfractions .15 .30 .60
2958 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2959 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2960 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2963 @item @emph{Standard}:
2969 @item @emph{Syntax}:
2970 @multitable @columnfractions .8
2971 @item @code{CALL ETIME(TARRAY, RESULT)}.
2972 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
2975 @item @emph{Arguments}:
2976 @multitable @columnfractions .15 .80
2977 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2978 @item @var{RESULT}@tab The type shall be @code{REAL}.
2981 @item @emph{Return value}:
2982 Elapsed time in seconds since the start of program execution.
2984 @item @emph{Example}:
2988 real, dimension(2) :: tarray
2990 call ETIME(tarray, result)
2994 do i=1,100000000 ! Just a delay
2997 call ETIME(tarray, result)
3001 end program test_etime
3004 @item @emph{See also}:
3012 @section @code{EXIT} --- Exit the program with status.
3017 @item @emph{Description}:
3018 @code{EXIT} causes immediate termination of the program with status. If status
3019 is omitted it returns the canonical @emph{success} for the system. All Fortran
3020 I/O units are closed.
3022 @item @emph{Standard}:
3028 @item @emph{Syntax}:
3029 @code{CALL EXIT([STATUS])}
3031 @item @emph{Arguments}:
3032 @multitable @columnfractions .15 .80
3033 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3036 @item @emph{Return value}:
3037 @code{STATUS} is passed to the parent process on exit.
3039 @item @emph{Example}:
3042 integer :: STATUS = 0
3043 print *, 'This program is going to exit.'
3045 end program test_exit
3048 @item @emph{See also}:
3049 @ref{ABORT}, @ref{KILL}
3055 @section @code{EXP} --- Exponential function
3056 @findex @code{EXP} intrinsic
3057 @findex @code{DEXP} intrinsic
3058 @findex @code{ZEXP} intrinsic
3059 @findex @code{CDEXP} intrinsic
3063 @item @emph{Description}:
3064 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3066 @item @emph{Standard}:
3067 F77 and later, has overloads that are GNU extensions
3072 @item @emph{Syntax}:
3075 @item @emph{Arguments}:
3076 @multitable @columnfractions .15 .80
3077 @item @var{X} @tab The type shall be @code{REAL(*)} or
3081 @item @emph{Return value}:
3082 The return value has same type and kind as @var{X}.
3084 @item @emph{Example}:
3089 end program test_exp
3092 @item @emph{Specific names}:
3093 @multitable @columnfractions .20 .20 .20 .40
3094 @item Name @tab Argument @tab Return type @tab Standard
3095 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
3096 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
3097 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3098 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3105 @section @code{EXPONENT} --- Exponent function
3106 @findex @code{EXPONENT} intrinsic
3107 @cindex exponent function
3110 @item @emph{Description}:
3111 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3112 is zero the value returned is zero.
3114 @item @emph{Standard}:
3120 @item @emph{Syntax}:
3121 @code{I = EXPONENT(X)}
3123 @item @emph{Arguments}:
3124 @multitable @columnfractions .15 .80
3125 @item @var{X} @tab The type shall be @code{REAL(*)}.
3128 @item @emph{Return value}:
3129 The return value is of type default @code{INTEGER}.
3131 @item @emph{Example}:
3133 program test_exponent
3138 print *, exponent(0.0)
3139 end program test_exponent
3145 @section @code{FDATE} --- Get the current time as a string
3146 @findex @code{FDATE} intrinsic
3147 @cindex fdate subroutine
3150 @item @emph{Description}:
3151 @code{FDATE(DATE)} returns the current date (using the same format as
3152 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3155 If @code{FDATE} is invoked as a function, it can not be invoked as a
3156 subroutine, and vice versa.
3158 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3160 @item @emph{Standard}:
3166 @item @emph{Syntax}:
3167 @multitable @columnfractions .80
3168 @item @code{CALL FDATE(DATE)}.
3169 @item @code{DATE = FDATE()}, (not recommended).
3172 @item @emph{Arguments}:
3173 @multitable @columnfractions .15 .80
3174 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3177 @item @emph{Return value}:
3178 The current date and time as a string.
3180 @item @emph{Example}:
3184 character(len=30) :: date
3186 print *, 'Program started on ', date
3187 do i = 1, 100000000 ! Just a delay
3191 print *, 'Program ended on ', date
3192 end program test_fdate
3198 @section @code{FLOAT} --- Convert integer to default real
3199 @findex @code{FLOAT} intrinsic
3200 @cindex conversion function (float)
3203 @item @emph{Description}:
3204 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3206 @item @emph{Standard}:
3212 @item @emph{Syntax}:
3215 @item @emph{Arguments}:
3216 @multitable @columnfractions .15 .80
3217 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3220 @item @emph{Return value}:
3221 The return value is of type default @code{REAL}
3223 @item @emph{Example}:
3227 if (float(i) /= 1.) call abort
3228 end program test_float
3231 @item @emph{See also}:
3232 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3238 @section @code{FGETC} --- Read a single character in stream mode
3239 @findex @code{FGETC} intrinsic
3240 @cindex undocumented intrinsic
3242 Intrinsic implemented, documentation pending.
3245 @item @emph{Description}:
3246 @item @emph{Standard}:
3250 @item @emph{Syntax}:
3251 @item @emph{Arguments}:
3252 @item @emph{Return value}:
3253 @item @emph{Example}:
3254 @item @emph{Specific names}:
3255 @item @emph{See also}:
3261 @section @code{FGET} --- Read a single character from stdin in stream mode
3262 @findex @code{FGET} intrinsic
3263 @cindex undocumented intrinsic
3265 Intrinsic implemented, documentation pending.
3268 @item @emph{Description}:
3269 @item @emph{Standard}:
3273 @item @emph{Syntax}:
3274 @item @emph{Arguments}:
3275 @item @emph{Return value}:
3276 @item @emph{Example}:
3277 @item @emph{Specific names}:
3278 @item @emph{See also}:
3283 @section @code{FLOOR} --- Integer floor function
3284 @findex @code{FLOOR} intrinsic
3288 @item @emph{Description}:
3289 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3291 @item @emph{Standard}:
3297 @item @emph{Syntax}:
3298 @code{I = FLOOR(X[,KIND])}
3300 @item @emph{Arguments}:
3301 @multitable @columnfractions .15 .80
3302 @item @var{X} @tab The type shall be @code{REAL(*)}.
3303 @item @var{KIND} @tab Optional scaler integer initialization expression.
3306 @item @emph{Return value}:
3307 The return value is of type @code{INTEGER(KIND)}
3309 @item @emph{Example}:
3314 print *, floor(x) ! returns 63
3315 print *, floor(y) ! returns -64
3316 end program test_floor
3319 @item @emph{See also}:
3320 @ref{CEILING}, @ref{NINT}
3327 @section @code{FLUSH} --- Flush I/O unit(s)
3328 @findex @code{FLUSH}
3332 @item @emph{Description}:
3333 Flushes Fortran unit(s) currently open for output. Without the optional
3334 argument, all units are flushed, otherwise just the unit specified.
3336 @item @emph{Standard}:
3340 non-elemental subroutine
3342 @item @emph{Syntax}:
3343 @code{CALL FLUSH(UNIT)}
3345 @item @emph{Arguments}:
3346 @multitable @columnfractions .15 .80
3347 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3351 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3352 statement that should be preferred over the @code{FLUSH} intrinsic.
3359 @section @code{FNUM} --- File number function
3360 @findex @code{FNUM} intrinsic
3364 @item @emph{Description}:
3365 @code{FNUM(UNIT)} returns the Posix file descriptor number corresponding to the
3366 open Fortran I/O unit @code{UNIT}.
3368 @item @emph{Standard}:
3372 non-elemental function
3374 @item @emph{Syntax}:
3375 @code{I = FNUM(UNIT)}
3377 @item @emph{Arguments}:
3378 @multitable @columnfractions .15 .80
3379 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3382 @item @emph{Return value}:
3383 The return value is of type @code{INTEGER}
3385 @item @emph{Example}:
3389 open (unit=10, status = "scratch")
3393 end program test_fnum
3400 @section @code{FPUT} --- Write a single character to stdout in stream mode
3401 @findex @code{FPUT} intrinsic
3402 @cindex undocumented intrinsic
3404 Intrinsic implemented, documentation pending.
3407 @item @emph{Description}:
3408 @item @emph{Standard}:
3412 @item @emph{Syntax}:
3413 @item @emph{Arguments}:
3414 @item @emph{Return value}:
3415 @item @emph{Example}:
3416 @item @emph{Specific names}:
3417 @item @emph{See also}:
3423 @section @code{FPUTC} --- Write a single character in stream mode
3424 @findex @code{FPUTC} intrinsic
3425 @cindex undocumented intrinsic
3427 Intrinsic implemented, documentation pending.
3430 @item @emph{Description}:
3431 @item @emph{Standard}:
3435 @item @emph{Syntax}:
3436 @item @emph{Arguments}:
3437 @item @emph{Return value}:
3438 @item @emph{Example}:
3439 @item @emph{Specific names}:
3440 @item @emph{See also}:
3446 @section @code{FRACTION} --- Fractional part of the model representation
3447 @findex @code{FRACTION} intrinsic
3448 @cindex fractional part
3451 @item @emph{Description}:
3452 @code{FRACTION(X)} returns the fractional part of the model
3453 representation of @code{X}.
3455 @item @emph{Standard}:
3461 @item @emph{Syntax}:
3462 @code{Y = FRACTION(X)}
3464 @item @emph{Arguments}:
3465 @multitable @columnfractions .15 .80
3466 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3469 @item @emph{Return value}:
3470 The return value is of the same type and kind as the argument.
3471 The fractional part of the model representation of @code{X} is returned;
3472 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3474 @item @emph{Example}:
3476 program test_fraction
3479 print *, fraction(x), x * radix(x)**(-exponent(x))
3480 end program test_fraction
3488 @section @code{FREE} --- Frees memory
3489 @findex @code{FREE} intrinsic
3493 @item @emph{Description}:
3494 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3495 intrinsic is an extension intended to be used with Cray pointers, and is
3496 provided in @command{gfortran} to allow user to compile legacy code. For
3497 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3500 @item @emph{Standard}:
3506 @item @emph{Syntax}:
3509 @item @emph{Arguments}:
3510 @multitable @columnfractions .15 .80
3511 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3512 location of the memory that should be de-allocated.
3515 @item @emph{Return value}:
3518 @item @emph{Example}:
3519 See @code{MALLOC} for an example.
3521 @item @emph{See also}:
3529 @section @code{FSTAT} --- Get file status
3530 @findex @code{FSTAT} intrinsic
3531 @cindex undocumented intrinsic
3533 Intrinsic implemented, documentation pending.
3536 @item @emph{Description}:
3539 @item @emph{Standard}:
3541 @item @emph{Syntax}:
3542 @item @emph{Arguments}:
3543 @item @emph{Return value}:
3544 @item @emph{Example}:
3545 @item @emph{Specific names}:
3546 @item @emph{See also}:
3552 @section @code{FSEEK} --- Low level file positioning subroutine
3553 @findex @code{FSEEK}
3554 @cindex file system functions
3556 Not yet implemented in gfortran.
3559 @item @emph{Description}:
3561 @item @emph{Standard}:
3567 @item @emph{Syntax}:
3568 @item @emph{Arguments}:
3569 @item @emph{Return value}:
3570 @item @emph{Example}:
3571 @item @emph{Specific names}:
3572 @item @emph{See also}:
3573 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3580 @section @code{FTELL} --- Current stream position
3581 @findex @code{FTELL} intrinsic
3582 @cindex undocumented intrinsic
3584 Intrinsic implemented, documentation pending.
3587 @item @emph{Description}:
3588 @item @emph{Standard}:
3592 @item @emph{Syntax}:
3593 @item @emph{Arguments}:
3594 @item @emph{Return value}:
3595 @item @emph{Example}:
3596 @item @emph{Specific names}:
3597 @item @emph{See also}:
3603 @section @code{GETARG} --- Get command line arguments
3604 @findex @code{GETARG} intrinsic
3605 @cindex undocumented intrinsic
3607 Intrinsic implemented, documentation pending.
3610 @item @emph{Description}:
3611 @item @emph{Standard}:
3615 @item @emph{Syntax}:
3616 @item @emph{Arguments}:
3617 @item @emph{Return value}:
3618 @item @emph{Example}:
3619 @item @emph{Specific names}:
3621 @item @emph{See also}:
3622 @ref{IARGC}, @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
3628 @section @code{GET_COMMAND} --- Subroutine to retrieve the entire command line
3629 @findex @code{GET_COMMAND} intrinsic
3630 @cindex undocumented intrinsic
3632 Intrinsic implemented, documentation pending.
3635 @item @emph{Description}:
3636 @item @emph{Standard}:
3640 @item @emph{Syntax}:
3641 @item @emph{Arguments}:
3642 @item @emph{Return value}:
3643 @item @emph{Example}:
3644 @item @emph{Specific names}:
3645 @item @emph{See also}:
3650 @node GET_COMMAND_ARGUMENT
3651 @section @code{GET_COMMAND_ARGUMENT} --- Subroutine to retrieve a command argument
3652 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
3653 @cindex undocumented intrinsic
3655 Intrinsic implemented, documentation pending.
3658 @item @emph{Description}:
3659 @item @emph{Standard}:
3663 @item @emph{Syntax}:
3664 @item @emph{Arguments}:
3665 @item @emph{Return value}:
3666 @item @emph{Example}:
3667 @item @emph{Specific names}:
3668 @item @emph{See also}:
3669 @ref{COMMAND_ARGUMENT_COUNT}
3675 @section @code{GETCWD} --- Get current working directory
3676 @findex @code{GETCWD} intrinsic
3677 @cindex undocumented intrinsic
3679 Intrinsic implemented, documentation pending.
3682 @item @emph{Description}:
3683 @item @emph{Standard}:
3687 @item @emph{Syntax}:
3688 @item @emph{Arguments}:
3689 @item @emph{Return value}:
3690 @item @emph{Example}:
3691 @item @emph{Specific names}:
3692 @item @emph{See also}:
3698 @section @code{GETENV} --- Get an environmental variable
3699 @findex @code{GETENV} intrinsic
3700 @cindex undocumented intrinsic
3702 Intrinsic implemented, documentation pending.
3705 @item @emph{Description}:
3706 @item @emph{Standard}:
3710 @item @emph{Syntax}:
3711 @item @emph{Arguments}:
3712 @item @emph{Return value}:
3713 @item @emph{Example}:
3714 @item @emph{Specific names}:
3715 @item @emph{See also}:
3716 @ref{GET_ENVIRONMENT_VARIABLE}
3721 @node GET_ENVIRONMENT_VARIABLE
3722 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
3723 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
3724 @cindex undocumented intrinsic
3726 Intrinsic implemented, documentation pending.
3729 @item @emph{Description}:
3730 @item @emph{Standard}:
3736 @item @emph{Syntax}:
3737 @item @emph{Arguments}:
3738 @item @emph{Return value}:
3739 @item @emph{Example}:
3740 @item @emph{Specific names}:
3741 @item @emph{See also}:
3747 @section @code{GETGID} --- Group ID function
3748 @findex @code{GETGID} intrinsic
3752 @item @emph{Description}:
3753 Returns the numerical group ID of the current process.
3755 @item @emph{Standard}:
3761 @item @emph{Syntax}:
3764 @item @emph{Return value}:
3765 The return value of @code{GETGID} is an @code{INTEGER} of the default
3769 @item @emph{Example}:
3770 See @code{GETPID} for an example.
3772 @item @emph{See also}:
3779 @section @code{GETLOG} --- Get login name
3780 @findex @code{GETLOG} intrinsic
3781 @cindex undocumented intrinsic
3783 Intrinsic implemented, documentation pending.
3786 @item @emph{Description}:
3787 @item @emph{Standard}:
3793 @item @emph{Syntax}:
3794 @item @emph{Arguments}:
3795 @item @emph{Return value}:
3796 @item @emph{Example}:
3797 @item @emph{Specific names}:
3798 @item @emph{See also}:
3805 @section @code{GETPID} --- Process ID function
3806 @findex @code{GETPID} intrinsic
3810 @item @emph{Description}:
3811 Returns the numerical process identifier of the current process.
3813 @item @emph{Standard}:
3819 @item @emph{Syntax}:
3822 @item @emph{Return value}:
3823 The return value of @code{GETPID} is an @code{INTEGER} of the default
3827 @item @emph{Example}:
3830 print *, "The current process ID is ", getpid()
3831 print *, "Your numerical user ID is ", getuid()
3832 print *, "Your numerical group ID is ", getgid()
3841 @section @code{GETUID} --- User ID function
3842 @findex @code{GETUID} intrinsic
3846 @item @emph{Description}:
3847 Returns the numerical user ID of the current process.
3849 @item @emph{Standard}:
3855 @item @emph{Syntax}:
3858 @item @emph{Return value}:
3859 The return value of @code{GETUID} is an @code{INTEGER} of the default
3863 @item @emph{Example}:
3864 See @code{GETPID} for an example.
3866 @item @emph{See also}:
3873 @section @code{GMTIME} --- Convert time to GMT info
3874 @findex @code{GMTIME}
3875 @cindex time function
3877 Not yet implemented in gfortran.
3880 @item @emph{Description}:
3882 @item @emph{Standard}:
3888 @item @emph{Syntax}:
3889 @item @emph{Arguments}:
3890 @item @emph{Return value}:
3891 @item @emph{Example}:
3892 @item @emph{Specific names}:
3893 @item @emph{See also}:
3894 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3901 @section @code{HOSTNM} --- Get system host name
3902 @findex @code{HOSTNM} intrinsic
3903 @cindex undocumented intrinsic
3905 Intrinsic implemented, documentation pending.
3908 @item @emph{Description}:
3909 @item @emph{Standard}:
3913 @item @emph{Syntax}:
3914 @item @emph{Arguments}:
3915 @item @emph{Return value}:
3916 @item @emph{Example}:
3917 @item @emph{Specific names}:
3918 @item @emph{See also}:
3924 @section @code{HUGE} --- Largest number of a kind
3925 @findex @code{HUGE} intrinsic
3929 @item @emph{Description}:
3930 @code{HUGE(X)} returns the largest number that is not an infinity in
3931 the model of the type of @code{X}.
3933 @item @emph{Standard}:
3939 @item @emph{Syntax}:
3942 @item @emph{Arguments}:
3943 @multitable @columnfractions .15 .80
3944 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
3947 @item @emph{Return value}:
3948 The return value is of the same type and kind as @var{X}
3950 @item @emph{Example}:
3952 program test_huge_tiny
3953 print *, huge(0), huge(0.0), huge(0.0d0)
3954 print *, tiny(0.0), tiny(0.0d0)
3955 end program test_huge_tiny
3962 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
3963 @findex @code{IACHAR} intrinsic
3964 @cindex @acronym{ASCII} collating sequence
3965 @cindex conversion function (character)
3968 @item @emph{Description}:
3969 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
3970 in the first character position of @code{C}.
3972 @item @emph{Standard}:
3978 @item @emph{Syntax}:
3979 @code{I = IACHAR(C)}
3981 @item @emph{Arguments}:
3982 @multitable @columnfractions .15 .80
3983 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
3986 @item @emph{Return value}:
3987 The return value is of type @code{INTEGER} and of the default integer
3990 @item @emph{Example}:
3995 end program test_iachar
3998 @item @emph{See also}:
3999 @ref{CHAR},@ref{ICHAR}
4005 @section @code{IAND} --- Bitwise logical and
4006 @findex @code{IAND} intrinsic
4007 @cindex bit operations
4009 Intrinsic implemented, documentation pending.
4012 @item @emph{Description}:
4013 @item @emph{Standard}:
4019 @item @emph{Syntax}:
4020 @item @emph{Arguments}:
4021 @item @emph{Return value}:
4022 @item @emph{Example}:
4023 @item @emph{Specific names}:
4025 @item @emph{See also}:
4026 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4033 @section @code{IARGC} --- Get number of command line arguments
4034 @findex @code{IARGC} intrinsic
4035 @cindex undocumented intrinsic
4037 Intrinsic implemented, documentation pending.
4040 @item @emph{Description}:
4041 @item @emph{Standard}:
4045 @item @emph{Syntax}:
4046 @item @emph{Arguments}:
4047 @item @emph{Return value}:
4048 @item @emph{Example}:
4049 @item @emph{Specific names}:
4050 @item @emph{See also}:
4051 @ref{GETARG}, @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}, @ref{GET_COMMAND_ARGUMENT}
4059 @section @code{IBCLR} --- Clear bit
4060 @findex @code{IBCLR} intrinsic
4061 @cindex bit operations
4063 Intrinsic implemented, documentation pending.
4066 @item @emph{Description}:
4067 @item @emph{Standard}:
4073 @item @emph{Syntax}:
4074 @item @emph{Arguments}:
4075 @item @emph{Return value}:
4076 @item @emph{Example}:
4077 @item @emph{Specific names}:
4079 @item @emph{See also}:
4080 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4087 @section @code{IBITS} --- Bit extraction
4088 @findex @code{IBITS} intrinsic
4089 @cindex bit operations
4091 Intrinsic implemented, documentation pending.
4094 @item @emph{Description}:
4095 @item @emph{Standard}:
4101 @item @emph{Syntax}:
4102 @item @emph{Arguments}:
4103 @item @emph{Return value}:
4104 @item @emph{Example}:
4105 @item @emph{Specific names}:
4106 @item @emph{See also}:
4107 @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4115 @section @code{IBSET} --- Set bit
4116 @findex @code{IBSET} intrinsic
4117 @cindex bit operations
4119 Intrinsic implemented, documentation pending.
4122 @item @emph{Description}:
4123 @item @emph{Standard}:
4129 @item @emph{Syntax}:
4130 @item @emph{Arguments}:
4131 @item @emph{Return value}:
4132 @item @emph{Example}:
4133 @item @emph{Specific names}:
4135 @item @emph{See also}:
4136 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4143 @section @code{ICHAR} --- Character-to-integer conversion function
4144 @findex @code{ICHAR} intrinsic
4145 @cindex conversion function (character)
4148 @item @emph{Description}:
4149 @code{ICHAR(C)} returns the code for the character in the first character
4150 position of @code{C} in the system's native character set.
4151 The correspondence between characters and their codes is not necessarily
4152 the same across different GNU Fortran implementations.
4154 @item @emph{Standard}:
4160 @item @emph{Syntax}:
4163 @item @emph{Arguments}:
4164 @multitable @columnfractions .15 .80
4165 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4168 @item @emph{Return value}:
4169 The return value is of type @code{INTEGER} and of the default integer
4172 @item @emph{Example}:
4177 end program test_ichar
4181 No intrinsic exists to convert a printable character string to a numerical
4182 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4183 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4186 Instead, you can use internal-file I/O to do this kind of conversion. For
4191 character(len=10) string
4194 read (string,'(I10)') value
4196 end program read_val
4201 @section @code{IDATE} --- Get current local time subroutine (day/month/year)
4202 @findex @code{IDATE} intrinsic
4205 @item @emph{Description}:
4206 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4207 current local time. The day (in the range 1-31), month (in the range 1-12),
4208 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively.
4209 The year has four significant digits.
4211 @item @emph{Standard}:
4217 @item @emph{Syntax}:
4218 @code{CALL IDATE(TARRAY)}
4220 @item @emph{Arguments}:
4221 @multitable @columnfractions .15 .80
4222 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4223 the kind shall be the default integer kind.
4226 @item @emph{Return value}:
4229 @item @emph{Example}:
4232 integer, dimension(3) :: tarray
4237 end program test_idate
4244 @section @code{IEOR} --- Bitwise logical exclusive or
4245 @findex @code{IEOR} intrinsic
4246 @cindex bit operations
4248 Intrinsic implemented, documentation pending.
4251 @item @emph{Description}:
4252 @item @emph{Standard}:
4258 @item @emph{Syntax}:
4259 @item @emph{Arguments}:
4260 @item @emph{Return value}:
4261 @item @emph{Example}:
4262 @item @emph{Specific names}:
4264 @item @emph{See also}:
4265 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4272 @section @code{IERRNO} --- Get the last system error number
4273 @findex @code{IERRNO} intrinsic
4274 @cindex undocumented intrinsic
4276 Intrinsic implemented, documentation pending.
4279 @item @emph{Description}:
4280 @item @emph{Standard}:
4284 @item @emph{Syntax}:
4285 @item @emph{Arguments}:
4286 @item @emph{Return value}:
4287 @item @emph{Example}:
4289 @item @emph{See also}:
4297 @section @code{INDEX} --- Position of a substring within a string
4298 @findex @code{INDEX} intrinsic
4299 @cindex undocumented intrinsic
4301 Intrinsic implemented, documentation pending.
4304 @item @emph{Description}:
4305 @item @emph{Standard}:
4311 @item @emph{Syntax}:
4312 @item @emph{Arguments}:
4313 @item @emph{Return value}:
4314 @item @emph{Example}:
4315 @item @emph{Specific names}:
4316 @item @emph{See also}:
4323 @section @code{INT} --- Convert to integer type
4324 @findex @code{INT} intrinsic
4325 @findex @code{IFIX} intrinsic
4326 @findex @code{IDINT} intrinsic
4327 @cindex conversion function (integer)
4330 @item @emph{Description}:
4331 Convert to integer type
4333 @item @emph{Standard}:
4339 @item @emph{Syntax}:
4340 @multitable @columnfractions .30 .80
4341 @item @code{X = INT(X)}
4342 @item @code{X = INT(X, KIND)}
4345 @item @emph{Arguments}:
4346 @multitable @columnfractions .15 .80
4347 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or @code{COMPLEX(*)}
4348 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
4351 @item @emph{Return value}:
4352 These functions return a @code{INTEGER(*)} variable or array under
4353 the following rules:
4357 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X}
4359 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}.
4360 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed
4361 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4363 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4366 @item @emph{Example}:
4370 complex :: z = (-3.7, 1.0)
4372 print *, int(z), int(z,8)
4376 @item @emph{Specific names}:
4377 @multitable @columnfractions .20 .20 .20 .40
4378 @item Name @tab Argument @tab Return type @tab Standard
4379 @item @code{IFIX(X)} @tab @code{REAL(4) X} @tab @code{INTEGER} @tab F77 and later
4380 @item @code{IDINT(X)} @tab @code{REAL(8) X} @tab @code{INTEGER} @tab F77 and later
4383 @comment @item @emph{See also}:
4390 @section @code{IOR} --- Bitwise logical or
4391 @findex @code{IOR} intrinsic
4392 @cindex bit operations
4394 Intrinsic implemented, documentation pending.
4397 @item @emph{Description}:
4398 @item @emph{Standard}:
4404 @item @emph{Syntax}:
4405 @item @emph{Arguments}:
4406 @item @emph{Return value}:
4407 @item @emph{Example}:
4408 @item @emph{Specific names}:
4410 @item @emph{See also}:
4411 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4418 @section @code{IRAND} --- Integer pseudo-random number
4419 @findex @code{IRAND} intrinsic
4420 @cindex random number
4423 @item @emph{Description}:
4424 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
4425 distribution between 0 and a system-dependent limit (which is in most
4426 cases 2147483647). If @var{FLAG} is 0, the next number
4427 in the current sequence is returned; if @var{FLAG} is 1, the generator
4428 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
4429 it is used as a new seed with @code{SRAND}.
4431 @item @emph{Standard}:
4435 non-elemental function
4437 @item @emph{Syntax}:
4438 @code{I = IRAND(FLAG)}
4440 @item @emph{Arguments}:
4441 @multitable @columnfractions .15 .80
4442 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
4445 @item @emph{Return value}:
4446 The return value is of @code{INTEGER(kind=4)} type.
4448 @item @emph{Example}:
4451 integer,parameter :: seed = 86456
4454 print *, irand(), irand(), irand(), irand()
4455 print *, irand(seed), irand(), irand(), irand()
4456 end program test_irand
4464 @section @code{ISHFT} --- Shift bits
4465 @findex @code{ISHFT} intrinsic
4466 @cindex bit manipulation
4468 Intrinsic implemented, documentation pending.
4471 @item @emph{Description}:
4472 @item @emph{Standard}:
4478 @item @emph{Syntax}:
4479 @item @emph{Arguments}:
4480 @item @emph{Return value}:
4481 @item @emph{Example}:
4482 @item @emph{Specific names}:
4484 @item @emph{See also}:
4492 @section @code{ISHFTC} --- Shift bits circularly
4493 @findex @code{ISHFTC} intrinsic
4494 @cindex bit manipulation
4496 Intrinsic implemented, documentation pending.
4499 @item @emph{Description}:
4500 @item @emph{Standard}:
4506 @item @emph{Syntax}:
4507 @item @emph{Arguments}:
4508 @item @emph{Return value}:
4509 @item @emph{Example}:
4510 @item @emph{Specific names}:
4512 @item @emph{See also}:
4519 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
4520 @findex @code{ITIME} intrinsic
4523 @item @emph{Description}:
4524 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4525 current local time. The hour (in the range 1-24), minute (in the range 1-60),
4526 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY},
4529 @item @emph{Standard}:
4535 @item @emph{Syntax}:
4536 @code{CALL ITIME(TARRAY)}
4538 @item @emph{Arguments}:
4539 @multitable @columnfractions .15 .80
4540 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
4541 and the kind shall be the default integer kind.
4544 @item @emph{Return value}:
4548 @item @emph{Example}:
4551 integer, dimension(3) :: tarray
4556 end program test_itime
4563 @section @code{KILL} --- Send a signal to a process
4564 @findex @code{KILL} intrinsic
4565 @cindex undocumented intrinsic
4567 Intrinsic implemented, documentation pending.
4570 @item @emph{Description}:
4571 @item @emph{Standard}:
4577 @item @emph{Syntax}:
4578 @item @emph{Arguments}:
4579 @item @emph{Return value}:
4580 @item @emph{Example}:
4581 @item @emph{Specific names}:
4583 @item @emph{See also}:
4584 @ref{ABORT}, @ref{EXIT}
4590 @section @code{KIND} --- Kind of an entity
4591 @findex @code{KIND} intrinsic
4594 @item @emph{Description}:
4595 @code{KIND(X)} returns the kind value of the entity @var{X}.
4597 @item @emph{Standard}:
4603 @item @emph{Syntax}:
4606 @item @emph{Arguments}:
4607 @multitable @columnfractions .15 .80
4608 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
4609 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
4612 @item @emph{Return value}:
4613 The return value is a scalar of type @code{INTEGER} and of the default
4616 @item @emph{Example}:
4619 integer,parameter :: kc = kind(' ')
4620 integer,parameter :: kl = kind(.true.)
4622 print *, "The default character kind is ", kc
4623 print *, "The default logical kind is ", kl
4624 end program test_kind
4632 @section @code{LBOUND} --- Lower dimension bounds of an array
4633 @findex @code{LBOUND} intrinsic
4634 @cindex undocumented intrinsic
4636 Intrinsic implemented, documentation pending.
4639 @item @emph{Description}:
4640 @item @emph{Standard}:
4646 @item @emph{Syntax}:
4647 @item @emph{Arguments}:
4648 @item @emph{Return value}:
4649 @item @emph{Example}:
4650 @item @emph{See also}:
4658 @section @code{LEN} --- Length of a character entity
4659 @findex @code{LEN} intrinsic
4660 @cindex undocumented intrinsic
4662 Intrinsic implemented, documentation pending.
4665 @item @emph{Description}:
4666 @item @emph{Standard}:
4672 @item @emph{Syntax}:
4673 @item @emph{Arguments}:
4674 @item @emph{Return value}:
4675 @item @emph{Example}:
4676 @item @emph{Specific names}:
4678 @item @emph{See also}:
4679 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
4686 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
4687 @findex @code{LEN_TRIM} intrinsic
4688 @cindex undocumented intrinsic
4690 Intrinsic implemented, documentation pending.
4693 @item @emph{Description}:
4694 @item @emph{Standard}:
4700 @item @emph{Syntax}:
4701 @item @emph{Arguments}:
4702 @item @emph{Return value}:
4703 @item @emph{Example}:
4705 @item @emph{See also}:
4706 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
4713 @section @code{LGE} --- Lexical greater than or equal
4714 @findex @code{LGE} intrinsic
4715 @cindex comparison (lexical)
4717 Intrinsic implemented, documentation pending.
4720 @item @emph{Description}:
4721 @item @emph{Standard}:
4727 @item @emph{Syntax}:
4728 @item @emph{Arguments}:
4729 @item @emph{Return value}:
4730 @item @emph{Example}:
4732 @item @emph{See also}:
4733 @ref{LGT}, @ref{LLE}, @ref{LLT}
4740 @section @code{LGT} --- Lexical greater than
4741 @findex @code{LGT} intrinsic
4742 @cindex comparison (lexical)
4744 Intrinsic implemented, documentation pending.
4747 @item @emph{Description}:
4748 @item @emph{Standard}:
4754 @item @emph{Syntax}:
4755 @item @emph{Arguments}:
4756 @item @emph{Return value}:
4757 @item @emph{Example}:
4759 @item @emph{See also}:
4760 @ref{LGE}, @ref{LLE}, @ref{LLT}
4767 @section @code{LINK} --- Create a hard link
4768 @findex @code{LINK} intrinsic
4769 @cindex file system operations
4771 Intrinsic implemented, documentation pending.
4774 @item @emph{Description}:
4775 @item @emph{Standard}:
4781 @item @emph{Syntax}:
4782 @item @emph{Arguments}:
4783 @item @emph{Return value}:
4784 @item @emph{Example}:
4785 @item @emph{Specific names}:
4787 @item @emph{See also}:
4795 @section @code{LLE} --- Lexical less than or equal
4796 @findex @code{LLE} intrinsic
4797 @cindex comparison (lexical)
4799 Intrinsic implemented, documentation pending.
4802 @item @emph{Description}:
4803 @item @emph{Standard}:
4809 @item @emph{Syntax}:
4810 @item @emph{Arguments}:
4811 @item @emph{Return value}:
4812 @item @emph{Example}:
4814 @item @emph{See also}:
4815 @ref{LGE}, @ref{LGT}, @ref{LLT}
4822 @section @code{LLT} --- Lexical less than
4823 @findex @code{LLT} intrinsic
4824 @cindex comparison (lexical)
4826 Intrinsic implemented, documentation pending.
4829 @item @emph{Description}:
4830 @item @emph{Standard}:
4836 @item @emph{Syntax}:
4837 @item @emph{Arguments}:
4838 @item @emph{Return value}:
4839 @item @emph{Example}:
4841 @item @emph{See also}:
4842 @ref{LGE}, @ref{LGT}, @ref{LLE}
4849 @section @code{LNBLNK} --- Index of the last non-blank character in a string
4850 @findex @code{LNBLNK} intrinsic
4851 @cindex undocumented intrinsic
4853 Intrinsic implemented, documentation pending.
4856 @item @emph{Description}:
4857 @item @emph{Standard}:
4861 @item @emph{Syntax}:
4862 @item @emph{Arguments}:
4863 @item @emph{Return value}:
4864 @item @emph{Example}:
4865 @item @emph{Specific names}:
4867 @item @emph{See also}:
4875 @section @code{LOC} --- Returns the address of a variable
4876 @findex @code{LOC} intrinsic
4880 @item @emph{Description}:
4881 @code{LOC(X)} returns the address of @var{X} as an integer.
4883 @item @emph{Standard}:
4889 @item @emph{Syntax}:
4892 @item @emph{Arguments}:
4893 @multitable @columnfractions .15 .80
4894 @item @var{X} @tab Variable of any type.
4897 @item @emph{Return value}:
4898 The return value is of type @code{INTEGER(n)}, where @code{n} is the
4899 size (in bytes) of a memory address on the target machine.
4901 @item @emph{Example}:
4908 end program test_loc
4913 @section @code{LOG} --- Logarithm function
4914 @findex @code{LOG} intrinsic
4915 @findex @code{ALOG} intrinsic
4916 @findex @code{DLOG} intrinsic
4917 @findex @code{CLOG} intrinsic
4918 @findex @code{ZLOG} intrinsic
4919 @findex @code{CDLOG} intrinsic
4923 @item @emph{Description}:
4924 @code{LOG(X)} computes the logarithm of @var{X}.
4926 @item @emph{Standard}:
4932 @item @emph{Syntax}:
4935 @item @emph{Arguments}:
4936 @multitable @columnfractions .15 .80
4937 @item @var{X} @tab The type shall be @code{REAL(*)} or
4941 @item @emph{Return value}:
4942 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
4943 The kind type parameter is the same as @var{X}.
4945 @item @emph{Example}:
4948 real(8) :: x = 1.0_8
4949 complex :: z = (1.0, 2.0)
4952 end program test_log
4955 @item @emph{Specific names}:
4956 @multitable @columnfractions .20 .20 .20 .40
4957 @item Name @tab Argument @tab Return type @tab Standard
4958 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
4959 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
4960 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
4961 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
4962 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
4969 @section @code{LOG10} --- Base 10 logarithm function
4970 @findex @code{LOG10} intrinsic
4971 @findex @code{ALOG10} intrinsic
4972 @findex @code{DLOG10} intrinsic
4976 @item @emph{Description}:
4977 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
4979 @item @emph{Standard}:
4985 @item @emph{Syntax}:
4988 @item @emph{Arguments}:
4989 @multitable @columnfractions .15 .80
4990 @item @var{X} @tab The type shall be @code{REAL(*)} or
4994 @item @emph{Return value}:
4995 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
4996 The kind type parameter is the same as @var{X}.
4998 @item @emph{Example}:
5001 real(8) :: x = 10.0_8
5003 end program test_log10
5006 @item @emph{Specific names}:
5007 @multitable @columnfractions .20 .20 .20 .40
5008 @item Name @tab Argument @tab Return type @tab Standard
5009 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F95 and later
5010 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
5016 @section @code{LOGICAL} --- Convert to logical type
5017 @findex @code{LOGICAL} intrinsic
5018 @cindex conversion function (logical)
5020 Intrinsic implemented, documentation pending.
5023 @item @emph{Description}:
5024 @item @emph{Standard}:
5030 @item @emph{Syntax}:
5031 @item @emph{Arguments}:
5032 @item @emph{Return value}:
5033 @item @emph{Example}:
5034 @item @emph{Specific names}:
5035 @item @emph{See also}:
5042 @section @code{LSHIFT} --- Left shift bits
5043 @findex @code{LSHIFT}
5044 @cindex bit manipulation
5046 Not yet implemented in gfortran.
5049 @item @emph{Description}:
5051 @item @emph{Standard}:
5057 @item @emph{Syntax}:
5058 @item @emph{Arguments}:
5059 @item @emph{Return value}:
5060 @item @emph{Example}:
5061 @item @emph{Specific names}:
5062 @item @emph{See also}:
5063 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
5070 @section @code{LTIME} --- Convert time to local time info
5071 @findex @code{LTIME}
5072 @cindex time function
5074 Not yet implemented in gfortran.
5077 @item @emph{Description}:
5079 @item @emph{Standard}:
5085 @item @emph{Syntax}:
5086 @item @emph{Arguments}:
5087 @item @emph{Return value}:
5088 @item @emph{Example}:
5089 @item @emph{Specific names}:
5090 @item @emph{See also}:
5091 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
5098 @section @code{MALLOC} --- Allocate dynamic memory
5099 @findex @code{MALLOC} intrinsic
5103 @item @emph{Description}:
5104 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5105 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5106 is an extension intended to be used with Cray pointers, and is provided
5107 in @command{gfortran} to allow user to compile legacy code. For new code
5108 using Fortran 95 pointers, the memory allocation intrinsic is
5111 @item @emph{Standard}:
5115 non-elemental function
5117 @item @emph{Syntax}:
5118 @code{PTR = MALLOC(SIZE)}
5120 @item @emph{Arguments}:
5121 @multitable @columnfractions .15 .80
5122 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5125 @item @emph{Return value}:
5126 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5127 variables of type @code{INTEGER(K)} have the same size as
5128 C pointers (@code{sizeof(void *)}).
5130 @item @emph{Example}:
5131 The following example demonstrates the use of @code{MALLOC} and
5132 @code{FREE} with Cray pointers. This example is intended to run on
5133 32-bit systems, where the default integer kind is suitable to store
5134 pointers; on 64-bit systems, ptr_x would need to be declared as
5135 @code{integer(kind=8)}.
5144 ptr_x = malloc(20*8)
5146 x(i) = sqrt(1.0d0 / i)
5154 end program test_malloc
5157 @item @emph{See also}:
5163 @section @code{MATMUL} --- matrix multiplication
5164 @findex @code{MATMUL} intrinsic
5165 @cindex matrix operations
5167 Intrinsic implemented, documentation pending.
5170 @item @emph{Description}:
5171 @item @emph{Standard}:
5175 Transformational function
5177 @item @emph{Syntax}:
5178 @item @emph{Arguments}:
5179 @item @emph{Return value}:
5180 @item @emph{Example}:
5181 @item @emph{See also}:
5186 @section @code{MAX} --- Maximum value of an argument list
5187 @findex @code{MAX} intrinsic
5188 @cindex undocumented intrinsic
5190 Intrinsic implemented, documentation pending.
5193 @item @emph{Description}:
5194 @item @emph{Standard}:
5200 @item @emph{Syntax}:
5201 @item @emph{Arguments}:
5202 @item @emph{Return value}:
5203 @item @emph{Example}:
5205 @item @emph{Specific names}:
5206 @multitable @columnfractions .20 .20 .20 .40
5207 @item Name @tab Argument @tab Return type @tab Standard
5208 @item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5209 @item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
5210 @item @code{MAX1(X)} @tab @code{REAL(*) X} @tab @code{INT(MAX(X))} @tab F77 and later
5211 @item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5212 @item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5215 @item @emph{See also}:
5216 @ref{MAXLOC} @ref{MAXVAL}
5221 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
5222 @findex @code{MAXEXPONENT} intrinsic
5226 @item @emph{Description}:
5227 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
5230 @item @emph{Standard}:
5236 @item @emph{Syntax}:
5237 @code{I = MAXEXPONENT(X)}
5239 @item @emph{Arguments}:
5240 @multitable @columnfractions .15 .80
5241 @item @var{X} @tab shall be of type @code{REAL}.
5244 @item @emph{Return value}:
5245 The return value is of type @code{INTEGER} and of the default integer
5248 @item @emph{Example}:
5254 print *, minexponent(x), maxexponent(x)
5255 print *, minexponent(y), maxexponent(y)
5256 end program exponents
5262 @section @code{MAXLOC} --- Location of the maximum value within an array
5263 @findex @code{MAXLOC} intrinsic
5264 @cindex undocumented intrinsic
5266 Intrinsic implemented, documentation pending.
5269 @item @emph{Description}:
5270 @item @emph{Standard}:
5274 Transformational function
5276 @item @emph{Syntax}:
5277 @item @emph{Arguments}:
5278 @item @emph{Return value}:
5279 @item @emph{Example}:
5280 @item @emph{See also}:
5281 @ref{MAX}, @ref{MAXVAL}
5287 @section @code{MAXVAL} --- Maximum value of an array
5288 @findex @code{MAXVAL} intrinsic
5289 @cindex undocumented intrinsic
5291 Intrinsic implemented, documentation pending.
5294 @item @emph{Description}:
5295 @item @emph{Standard}:
5299 Transformational function
5301 @item @emph{Syntax}:
5302 @item @emph{Arguments}:
5303 @item @emph{Return value}:
5304 @item @emph{Example}:
5305 @item @emph{Specific names}:
5307 @item @emph{See also}:
5308 @ref{MAX}, @ref{MAXLOC}
5315 @section @code{MERGE} --- Merge arrays
5316 @findex @code{MERGE} intrinsic
5317 @cindex undocumented intrinsic
5319 Intrinsic implemented, documentation pending.
5322 @item @emph{Description}:
5323 @item @emph{Standard}:
5329 @item @emph{Syntax}:
5330 @item @emph{Arguments}:
5331 @item @emph{Return value}:
5332 @item @emph{Example}:
5333 @item @emph{Specific names}:
5334 @item @emph{See also}:
5339 @section @code{MIN} --- Minimum value of an argument list
5340 @findex @code{MIN} intrinsic
5341 @cindex undocumented intrinsic
5343 Intrinsic implemented, documentation pending.
5346 @item @emph{Description}:
5347 @item @emph{Standard}:
5353 @item @emph{Syntax}:
5354 @item @emph{Arguments}:
5355 @item @emph{Return value}:
5356 @item @emph{Example}:
5358 @item @emph{Specific names}:
5359 @multitable @columnfractions .20 .20 .20 .40
5360 @item Name @tab Argument @tab Return type @tab Standard
5361 @item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5362 @item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
5363 @item @code{MIN1(X)} @tab @code{REAL(*) X} @tab @code{INT(MIN(X))} @tab F77 and later
5364 @item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5365 @item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5368 @item @emph{See also}:
5369 @ref{MINLOC}, @ref{MINVAL}
5373 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
5374 @findex @code{MINEXPONENT} intrinsic
5378 @item @emph{Description}:
5379 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
5382 @item @emph{Standard}:
5388 @item @emph{Syntax}:
5389 @code{I = MINEXPONENT(X)}
5391 @item @emph{Arguments}:
5392 @multitable @columnfractions .15 .80
5393 @item @var{X} @tab shall be of type @code{REAL}.
5396 @item @emph{Return value}:
5397 The return value is of type @code{INTEGER} and of the default integer
5400 @item @emph{Example}:
5401 See @code{MAXEXPONENT} for an example.
5406 @section @code{MINLOC} --- Location of the minimum value within an array
5407 @findex @code{MINLOC} intrinsic
5408 @cindex undocumented intrinsic
5410 Intrinsic implemented, documentation pending.
5413 @item @emph{Description}:
5414 @item @emph{Standard}:
5418 Transformational function
5420 @item @emph{Syntax}:
5421 @item @emph{Arguments}:
5422 @item @emph{Return value}:
5423 @item @emph{Example}:
5425 @item @emph{See also}:
5426 @ref{MIN}, @ref{MINVAL}
5432 @section @code{MINVAL} --- Minimum value of an array
5433 @findex @code{MINVAL} intrinsic
5434 @cindex undocumented intrinsic
5436 Intrinsic implemented, documentation pending.
5439 @item @emph{Description}:
5440 @item @emph{Standard}:
5444 Transformational function
5446 @item @emph{Syntax}:
5447 @item @emph{Arguments}:
5448 @item @emph{Return value}:
5449 @item @emph{Example}:
5451 @item @emph{See also}:
5452 @ref{MIN}, @ref{MINLOC}
5459 @section @code{MOD} --- Remainder function
5460 @findex @code{MOD} intrinsic
5461 @findex @code{AMOD} intrinsic
5462 @findex @code{DMOD} intrinsic
5466 @item @emph{Description}:
5467 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
5468 calculated as @code{A - (INT(A/P) * P)}.
5470 @item @emph{Standard}:
5476 @item @emph{Syntax}:
5479 @item @emph{Arguments}:
5480 @multitable @columnfractions .15 .80
5481 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5482 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
5486 @item @emph{Return value}:
5487 The kind of the return value is the result of cross-promoting
5488 the kinds of the arguments.
5490 @item @emph{Example}:
5494 print *, mod(17.5,5.5)
5495 print *, mod(17.5d0,5.5)
5496 print *, mod(17.5,5.5d0)
5499 print *, mod(-17.5,5.5)
5500 print *, mod(-17.5d0,5.5)
5501 print *, mod(-17.5,5.5d0)
5504 print *, mod(17.5,-5.5)
5505 print *, mod(17.5d0,-5.5)
5506 print *, mod(17.5,-5.5d0)
5507 end program test_mod
5510 @item @emph{Specific names}:
5511 @multitable @columnfractions .20 .20 .20 .40
5512 @item Name @tab Arguments @tab Return type @tab Standard
5513 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
5514 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
5521 @section @code{MODULO} --- Modulo function
5522 @findex @code{MODULO} intrinsic
5526 @item @emph{Description}:
5527 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
5529 @item @emph{Standard}:
5535 @item @emph{Syntax}:
5536 @code{X = MODULO(A,P)}
5538 @item @emph{Arguments}:
5539 @multitable @columnfractions .15 .80
5540 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5541 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
5544 @item @emph{Return value}:
5545 The type and kind of the result are those of the arguments.
5547 @item If @var{A} and @var{P} are of type @code{INTEGER}:
5548 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
5549 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
5551 @item If @var{A} and @var{P} are of type @code{REAL}:
5552 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
5554 In all cases, if @var{P} is zero the result is processor-dependent.
5556 @item @emph{Example}:
5559 print *, modulo(17,3)
5560 print *, modulo(17.5,5.5)
5562 print *, modulo(-17,3)
5563 print *, modulo(-17.5,5.5)
5565 print *, modulo(17,-3)
5566 print *, modulo(17.5,-5.5)
5567 end program test_mod
5575 @section @code{MVBITS} --- Move bits from one integer to another
5576 @findex @code{MVBITS} intrinsic
5577 @cindex bit operations
5579 Intrinsic implemented, documentation pending.
5582 @item @emph{Description}:
5583 @item @emph{Standard}:
5587 Elemental subroutine
5589 @item @emph{Syntax}:
5590 @item @emph{Arguments}:
5591 @item @emph{Return value}:
5592 @item @emph{Example}:
5593 @item @emph{See also}:
5600 @section @code{NEAREST} --- Nearest representable number
5601 @findex @code{NEAREST} intrinsic
5602 @cindex processor-representable number
5605 @item @emph{Description}:
5606 @code{NEAREST(X, S)} returns the processor-representable number nearest
5607 to @code{X} in the direction indicated by the sign of @code{S}.
5609 @item @emph{Standard}:
5615 @item @emph{Syntax}:
5616 @code{Y = NEAREST(X, S)}
5618 @item @emph{Arguments}:
5619 @multitable @columnfractions .15 .80
5620 @item @var{X} @tab shall be of type @code{REAL}.
5621 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
5625 @item @emph{Return value}:
5626 The return value is of the same type as @code{X}. If @code{S} is
5627 positive, @code{NEAREST} returns the processor-representable number
5628 greater than @code{X} and nearest to it. If @code{S} is negative,
5629 @code{NEAREST} returns the processor-representable number smaller than
5630 @code{X} and nearest to it.
5632 @item @emph{Example}:
5634 program test_nearest
5636 x = nearest(42.0, 1.0)
5637 y = nearest(42.0, -1.0)
5638 write (*,"(3(G20.15))") x, y, x - y
5639 end program test_nearest
5646 @section @code{NEQV} --- Logical non-equivalence
5647 @findex @code{NEQV} intrinsic
5648 @cindex logical operations
5650 Intrinsic implemented, documentation pending.
5653 @item @emph{Description}:
5654 @item @emph{Standard}:
5658 @item @emph{Syntax}:
5659 @item @emph{Arguments}:
5660 @item @emph{Return value}:
5661 @item @emph{Example}:
5662 @item @emph{Specific names}:
5663 @item @emph{See also}:
5671 @section @code{NINT} --- Nearest whole number
5672 @findex @code{NINT} intrinsic
5673 @findex @code{IDNINT} intrinsic
5674 @cindex whole number
5677 @item @emph{Description}:
5678 @code{NINT(X)} rounds its argument to the nearest whole number.
5680 @item @emph{Standard}:
5686 @item @emph{Syntax}:
5689 @item @emph{Arguments}:
5690 @multitable @columnfractions .15 .80
5691 @item @var{X} @tab The type of the argument shall be @code{REAL}.
5694 @item @emph{Return value}:
5695 Returns @var{A} with the fractional portion of its magnitude eliminated by
5696 rounding to the nearest whole number and with its sign preserved,
5697 converted to an @code{INTEGER} of the default kind.
5699 @item @emph{Example}:
5706 print *, nint(x4), idnint(x8)
5707 end program test_nint
5710 @item @emph{Specific names}:
5711 @multitable @columnfractions .33 .33 .33
5712 @item Name @tab Argument @tab Standard
5713 @item @code{IDNINT(X)} @tab @code{REAL(8)} @tab F95 and later
5716 @item @emph{See also}:
5717 @ref{CEILING}, @ref{FLOOR}
5723 @section @code{NOT} --- Logical negation
5724 @findex @code{NOT} intrinsic
5725 @cindex logical operations
5727 Intrinsic implemented, documentation pending.
5730 @item @emph{Description}:
5731 @item @emph{Standard}:
5737 @item @emph{Syntax}:
5738 @item @emph{Arguments}:
5739 @item @emph{Return value}:
5740 @item @emph{Example}:
5741 @item @emph{See also}:
5748 @section @code{NULL} --- Function that returns an dissassociated pointer
5749 @findex @code{NULL} intrinsic
5750 @cindex undocumented intrinsic
5752 Intrinsic implemented, documentation pending.
5755 @item @emph{Description}:
5756 @item @emph{Standard}:
5760 Transformational function
5762 @item @emph{Syntax}:
5763 @item @emph{Arguments}:
5764 @item @emph{Return value}:
5765 @item @emph{Example}:
5766 @item @emph{See also}:
5774 @section @code{OR} --- Logical inclusive disjunction
5775 @findex @code{OR} intrinsic
5776 @cindex logical operations
5778 Intrinsic implemented, documentation pending.
5781 @item @emph{Description}:
5782 @item @emph{Standard}:
5786 @item @emph{Syntax}:
5787 @item @emph{Arguments}:
5788 @item @emph{Return value}:
5789 @item @emph{Example}:
5790 @item @emph{See also}:
5797 @section @code{PACK} --- Pack an array into an array of rank one
5798 @findex @code{PACK} intrinsic
5799 @cindex undocumented intrinsic
5801 Intrinsic implemented, documentation pending.
5804 @item @emph{Description}:
5805 @item @emph{Standard}:
5809 Transformational function
5811 @item @emph{Syntax}:
5812 @item @emph{Arguments}:
5813 @item @emph{Return value}:
5814 @item @emph{Example}:
5815 @item @emph{Specific names}:
5816 @item @emph{See also}:
5824 @section @code{PERROR} --- Print system error message
5825 @findex @code{PERROR} intrinsic
5826 @cindex undocumented intrinsic
5828 Intrinsic implemented, documentation pending.
5831 @item @emph{Description}:
5832 @item @emph{Standard}:
5838 @item @emph{Syntax}:
5839 @item @emph{Arguments}:
5840 @item @emph{Return value}:
5841 @item @emph{Example}:
5842 @item @emph{Specific names}:
5843 @item @emph{See also}:
5851 @section @code{PRECISION} --- Decimal precision of a real kind
5852 @findex @code{PRECISION} intrinsic
5856 @item @emph{Description}:
5857 @code{PRECISION(X)} returns the decimal precision in the model of the
5860 @item @emph{Standard}:
5866 @item @emph{Syntax}:
5867 @code{I = PRECISION(X)}
5869 @item @emph{Arguments}:
5870 @multitable @columnfractions .15 .80
5871 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
5874 @item @emph{Return value}:
5875 The return value is of type @code{INTEGER} and of the default integer
5878 @item @emph{Example}:
5880 program prec_and_range
5881 real(kind=4) :: x(2)
5882 complex(kind=8) :: y
5884 print *, precision(x), range(x)
5885 print *, precision(y), range(y)
5886 end program prec_and_range
5893 @section @code{PRESENT} --- Determine whether an optional argument is specified
5894 @findex @code{PRESENT} intrinsic
5895 @cindex undocumented intrinsic
5897 Intrinsic implemented, documentation pending.
5900 @item @emph{Description}:
5901 @item @emph{Standard}:
5907 @item @emph{Syntax}:
5908 @item @emph{Arguments}:
5909 @item @emph{Return value}:
5910 @item @emph{Example}:
5911 @item @emph{See also}:
5918 @section @code{PRODUCT} --- Product of array elements
5919 @findex @code{PRODUCT} intrinsic
5920 @cindex undocumented intrinsic
5922 Intrinsic implemented, documentation pending.
5925 @item @emph{Description}:
5926 @item @emph{Standard}:
5930 Transformational function
5932 @item @emph{Syntax}:
5933 @item @emph{Arguments}:
5934 @item @emph{Return value}:
5935 @item @emph{Example}:
5936 @item @emph{Specific names}:
5937 @item @emph{See also}:
5945 @section @code{RADIX} --- Base of a model number
5946 @findex @code{RADIX} intrinsic
5950 @item @emph{Description}:
5951 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
5953 @item @emph{Standard}:
5959 @item @emph{Syntax}:
5962 @item @emph{Arguments}:
5963 @multitable @columnfractions .15 .80
5964 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
5967 @item @emph{Return value}:
5968 The return value is a scalar of type @code{INTEGER} and of the default
5971 @item @emph{Example}:
5974 print *, "The radix for the default integer kind is", radix(0)
5975 print *, "The radix for the default real kind is", radix(0.0)
5976 end program test_radix
5984 @section @code{RANDOM_NUMBER} --- Pseudo-random number
5985 @findex @code{RANDOM_NUMBER} intrinsic
5986 @cindex random numbers
5988 Intrinsic implemented, documentation pending.
5991 @item @emph{Description}:
5992 @item @emph{Standard}:
5996 Elemental subroutine
5998 @item @emph{Syntax}:
5999 @item @emph{Arguments}:
6000 @item @emph{Return value}:
6001 @item @emph{Example}:
6002 @item @emph{See also}:
6010 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6011 @findex @code{RANDOM_SEED} intrinsic
6012 @cindex random numbers
6014 Intrinsic implemented, documentation pending.
6017 @item @emph{Description}:
6018 @item @emph{Standard}:
6024 @item @emph{Syntax}:
6025 @item @emph{Arguments}:
6026 @item @emph{Return value}:
6027 @item @emph{Example}:
6028 @item @emph{See also}:
6036 @section @code{RAND} --- Real pseudo-random number
6037 @findex @code{RAND} intrinsic
6038 @findex @code{RAN} intrinsic
6039 @cindex random number
6042 @item @emph{Description}:
6043 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6044 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6045 in the current sequence is returned; if @var{FLAG} is 1, the generator
6046 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6047 it is used as a new seed with @code{SRAND}.
6049 @item @emph{Standard}:
6053 non-elemental function
6055 @item @emph{Syntax}:
6056 @code{X = RAND(FLAG)}
6058 @item @emph{Arguments}:
6059 @multitable @columnfractions .15 .80
6060 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6063 @item @emph{Return value}:
6064 The return value is of @code{REAL} type and the default kind.
6066 @item @emph{Example}:
6069 integer,parameter :: seed = 86456
6072 print *, rand(), rand(), rand(), rand()
6073 print *, rand(seed), rand(), rand(), rand()
6074 end program test_rand
6078 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6079 provided as an alias for @code{RAND}.
6081 @item @emph{See also}:
6082 @ref{SRAND}, @ref{RANDOM_NUMBER}
6089 @section @code{RANGE} --- Decimal exponent range of a real kind
6090 @findex @code{RANGE} intrinsic
6094 @item @emph{Description}:
6095 @code{RANGE(X)} returns the decimal exponent range in the model of the
6098 @item @emph{Standard}:
6104 @item @emph{Syntax}:
6107 @item @emph{Arguments}:
6108 @multitable @columnfractions .15 .80
6109 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6112 @item @emph{Return value}:
6113 The return value is of type @code{INTEGER} and of the default integer
6116 @item @emph{Example}:
6117 See @code{PRECISION} for an example.
6123 @section @code{RAN} --- Real pseudo-random number
6124 @findex @code{RAN} intrinsic
6125 @cindex random number
6128 @item @emph{Standard}:
6131 @item @emph{See also}:
6132 @ref{RAND}, @ref{RANDOM_NUMBER}
6138 @section @code{REAL} --- Convert to real type
6139 @findex @code{REAL} intrinsic
6140 @findex @code{REALPART} intrinsic
6144 @item @emph{Description}:
6145 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
6146 @code{REALPART(X)} function is provided for compatibility with @command{g77},
6147 and its use is strongly discouraged.
6149 @item @emph{Standard}:
6155 @item @emph{Syntax}:
6156 @multitable @columnfractions .30 .80
6157 @item @code{X = REAL(X)}
6158 @item @code{X = REAL(X, KIND)}
6159 @item @code{X = REALPART(Z)}
6162 @item @emph{Arguments}:
6163 @multitable @columnfractions .15 .80
6164 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
6166 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
6169 @item @emph{Return value}:
6170 These functions return a @code{REAL(*)} variable or array under
6171 the following rules:
6175 @code{REAL(X)} is converted to a default real type if @var{X} is an
6176 integer or real variable.
6178 @code{REAL(X)} is converted to a real type with the kind type parameter
6179 of @var{X} if @var{X} is a complex variable.
6181 @code{REAL(X, KIND)} is converted to a real type with kind type
6182 parameter @var{KIND} if @var{X} is a complex, integer, or real
6186 @item @emph{Example}:
6189 complex :: x = (1.0, 2.0)
6190 print *, real(x), real(x,8), realpart(x)
6191 end program test_real
6194 @item @emph{See also}:
6195 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
6201 @section @code{RENAME} --- Rename a file
6202 @findex @code{RENAME} intrinsic
6203 @cindex file system operations
6205 Intrinsic implemented, documentation pending.
6208 @item @emph{Description}:
6209 @item @emph{Standard}:
6215 @item @emph{Syntax}:
6216 @item @emph{Arguments}:
6217 @item @emph{Return value}:
6218 @item @emph{Example}:
6219 @item @emph{See also}:
6226 @section @code{REPEAT} --- Repeated string concatenation
6227 @findex @code{REPEAT} intrinsic
6228 @cindex string manipulation
6230 Intrinsic implemented, documentation pending.
6233 @item @emph{Description}:
6234 @item @emph{Standard}:
6238 Transformational function
6240 @item @emph{Syntax}:
6241 @item @emph{Arguments}:
6242 @item @emph{Return value}:
6243 @item @emph{Example}:
6244 @item @emph{See also}:
6251 @section @code{RESHAPE} --- Function to reshape an array
6252 @findex @code{RESHAPE} intrinsic
6253 @cindex array manipulation
6255 Intrinsic implemented, documentation pending.
6258 @item @emph{Description}:
6259 @item @emph{Standard}:
6263 Transformational function
6265 @item @emph{Syntax}:
6266 @item @emph{Arguments}:
6267 @item @emph{Return value}:
6268 @item @emph{Example}:
6269 @item @emph{See also}:
6276 @section @code{RRSPACING} --- Reciprocal of the relative spacing
6277 @findex @code{RRSPACING} intrinsic
6280 @item @emph{Description}:
6281 @code{RRSPACING(X)} returns the reciprocal of the relative spacing of
6282 model numbers near @var{X}.
6284 @item @emph{Standard}:
6290 @item @emph{Syntax}:
6291 @code{Y = RRSPACING(X)}
6293 @item @emph{Arguments}:
6294 @multitable @columnfractions .15 .80
6295 @item @var{X} @tab shall be of type @code{REAL}.
6298 @item @emph{Return value}:
6299 The return value is of the same type and kind as @var{X}.
6300 The value returned is equal to
6301 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
6308 @section @code{RSHIFT} --- Right shift bits
6309 @findex @code{RSHIFT}
6310 @cindex bit manipulation
6312 Not yet implemented in gfortran.
6315 @item @emph{Description}:
6317 @item @emph{Standard}:
6323 @item @emph{Syntax}:
6324 @item @emph{Arguments}:
6325 @item @emph{Return value}:
6326 @item @emph{Example}:
6327 @item @emph{See also}:
6328 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
6335 @section @code{SCALE} --- Scale a real value
6336 @findex @code{SCALE} intrinsic
6339 @item @emph{Description}:
6340 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
6342 @item @emph{Standard}:
6348 @item @emph{Syntax}:
6349 @code{Y = SCALE(X, I)}
6351 @item @emph{Arguments}:
6352 @multitable @columnfractions .15 .80
6353 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
6354 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
6357 @item @emph{Return value}:
6358 The return value is of the same type and kind as @var{X}.
6359 Its value is @code{X * RADIX(X)**I}.
6361 @item @emph{Example}:
6364 real :: x = 178.1387e-4
6366 print *, scale(x,i), x*radix(x)**i
6367 end program test_scale
6374 @section @code{SCAN} --- Scan a string for the presence of a set of characters
6375 @findex @code{SCAN} intrinsic
6376 @cindex string manipulation
6378 Intrinsic implemented, documentation pending.
6381 @item @emph{Description}:
6382 @item @emph{Standard}:
6388 @item @emph{Syntax}:
6389 @item @emph{Arguments}:
6390 @item @emph{Return value}:
6391 @item @emph{Example}:
6392 @item @emph{See also}:
6399 @section @code{SECNDS} --- Time function
6400 @findex @code{SECNDS} intrinsic
6404 @item @emph{Description}:
6405 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
6406 @var{X} is a reference time, also in seconds. If this is zero, the time in
6407 seconds from midnight is returned. This function is non-standard and its
6410 @item @emph{Standard}:
6416 @item @emph{Syntax}:
6417 @code{T = SECNDS (X)}
6419 @item @emph{Arguments}:
6420 @multitable @columnfractions .15 .80
6421 @item Name @tab Type
6422 @item @var{T} @tab REAL(4)
6423 @item @var{X} @tab REAL(4)
6426 @item @emph{Return value}:
6429 @item @emph{Example}:
6433 print *, secnds (0.0) ! seconds since midnight
6434 t1 = secnds (0.0) ! reference time
6435 do i = 1, 10000000 ! do something
6437 t2 = secnds (t1) ! elapsed time
6438 print *, "Something took ", t2, " seconds."
6439 end program test_secnds
6445 @node SELECTED_INT_KIND
6446 @section @code{SELECTED_INT_KIND} --- Choose integer kind
6447 @findex @code{SELECTED_INT_KIND} intrinsic
6448 @cindex integer kind
6451 @item @emph{Description}:
6452 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
6453 type that can represent all values ranging from @math{-10^I} (exclusive)
6454 to @math{10^I} (exclusive). If there is no integer kind that accommodates
6455 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
6457 @item @emph{Standard}:
6461 Transformational function
6463 @item @emph{Syntax}:
6464 @multitable @columnfractions .30 .80
6465 @item @code{J = SELECTED_INT_KIND(I)}
6468 @item @emph{Arguments}:
6469 @multitable @columnfractions .15 .80
6470 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
6473 @item @emph{Example}:
6475 program large_integers
6476 integer,parameter :: k5 = selected_int_kind(5)
6477 integer,parameter :: k15 = selected_int_kind(15)
6478 integer(kind=k5) :: i5
6479 integer(kind=k15) :: i15
6481 print *, huge(i5), huge(i15)
6483 ! The following inequalities are always true
6484 print *, huge(i5) >= 10_k5**5-1
6485 print *, huge(i15) >= 10_k15**15-1
6486 end program large_integers
6492 @node SELECTED_REAL_KIND
6493 @section @code{SELECTED_REAL_KIND} --- Choose real kind
6494 @findex @code{SELECTED_REAL_KIND} intrinsic
6498 @item @emph{Description}:
6499 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
6500 with decimal precision greater of at least @code{P} digits and exponent
6501 range greater at least @code{R}.
6503 @item @emph{Standard}:
6507 Transformational function
6509 @item @emph{Syntax}:
6510 @multitable @columnfractions .30 .80
6511 @item @code{I = SELECTED_REAL_KIND(P,R)}
6514 @item @emph{Arguments}:
6515 @multitable @columnfractions .15 .80
6516 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
6517 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
6519 At least one argument shall be present.
6521 @item @emph{Return value}:
6523 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
6524 a real data type with decimal precision of at least @code{P} digits and a
6525 decimal exponent range of at least @code{R}. If more than one real data
6526 type meet the criteria, the kind of the data type with the smallest
6527 decimal precision is returned. If no real data type matches the criteria,
6530 @item -1 if the processor does not support a real data type with a
6531 precision greater than or equal to @code{P}
6532 @item -2 if the processor does not support a real type with an exponent
6533 range greater than or equal to @code{R}
6534 @item -3 if neither is supported.
6537 @item @emph{Example}:
6540 integer,parameter :: p6 = selected_real_kind(6)
6541 integer,parameter :: p10r100 = selected_real_kind(10,100)
6542 integer,parameter :: r400 = selected_real_kind(r=400)
6544 real(kind=p10r100) :: y
6545 real(kind=r400) :: z
6547 print *, precision(x), range(x)
6548 print *, precision(y), range(y)
6549 print *, precision(z), range(z)
6550 end program real_kinds
6557 @section @code{SET_EXPONENT} --- Set the exponent of the model
6558 @findex @code{SET_EXPONENT} intrinsic
6562 @item @emph{Description}:
6563 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
6564 is that that of @var{X} and whose exponent part if @var{I}.
6566 @item @emph{Standard}:
6572 @item @emph{Syntax}:
6573 @code{Y = SET_EXPONENT(X, I)}
6575 @item @emph{Arguments}:
6576 @multitable @columnfractions .15 .80
6577 @item @var{X} @tab shall be of type @code{REAL}.
6578 @item @var{I} @tab shall be of type @code{INTEGER}.
6581 @item @emph{Return value}:
6582 The return value is of the same type and kind as @var{X}.
6583 The real number whose fractional part
6584 is that that of @var{X} and whose exponent part if @var{I} is returned;
6585 it is @code{FRACTION(X) * RADIX(X)**I}.
6587 @item @emph{Example}:
6590 real :: x = 178.1387e-4
6592 print *, set_exponent(x), fraction(x) * radix(x)**i
6593 end program test_setexp
6601 @section @code{SHAPE} --- Determine the shape of an array
6602 @findex @code{SHAPE} intrinsic
6603 @cindex array manipulation
6605 Intrinsic implemented, documentation pending.
6608 @item @emph{Description}:
6609 @item @emph{Standard}:
6615 @item @emph{Syntax}:
6616 @item @emph{Arguments}:
6617 @item @emph{Return value}:
6618 @item @emph{Example}:
6619 @item @emph{See also}:
6627 @section @code{SIGN} --- Sign copying function
6628 @findex @code{SIGN} intrinsic
6629 @findex @code{ISIGN} intrinsic
6630 @findex @code{DSIGN} intrinsic
6631 @cindex sign copying
6634 @item @emph{Description}:
6635 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
6637 @item @emph{Standard}:
6643 @item @emph{Syntax}:
6644 @code{X = SIGN(A,B)}
6646 @item @emph{Arguments}:
6647 @multitable @columnfractions .15 .80
6648 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6649 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
6652 @item @emph{Return value}:
6653 The kind of the return value is that of @var{A} and @var{B}.
6654 If @math{B\ge 0} then the result is @code{ABS(A)}, else
6655 it is @code{-ABS(A)}.
6657 @item @emph{Example}:
6660 print *, sign(-12,1)
6661 print *, sign(-12,0)
6662 print *, sign(-12,-1)
6664 print *, sign(-12.,1.)
6665 print *, sign(-12.,0.)
6666 print *, sign(-12.,-1.)
6667 end program test_sign
6670 @item @emph{Specific names}:
6671 @multitable @columnfractions .20 .20 .20 .40
6672 @item Name @tab Arguments @tab Return type @tab Standard
6673 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
6674 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
6681 @section @code{SIGNAL} --- Signal handling subroutine (or function)
6682 @findex @code{SIGNAL} intrinsic
6683 @cindex SIGNAL subroutine
6686 @item @emph{Description}:
6687 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
6688 @var{HANDLER} to be executed with a single integer argument when signal
6689 @var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
6690 turn off handling of signal @var{NUMBER} or revert to its default
6691 action. See @code{signal(2)}.
6693 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
6694 is supplied, it is set to the value returned by @code{signal(2)}.
6696 @item @emph{Standard}:
6700 subroutine, non-elemental function
6702 @item @emph{Syntax}:
6703 @multitable @columnfractions .30 .80
6704 @item @code{CALL ALARM(NUMBER, HANDLER)}
6705 @item @code{CALL ALARM(NUMBER, HANDLER, STATUS)}
6706 @item @code{STATUS = ALARM(NUMBER, HANDLER)}
6709 @item @emph{Arguments}:
6710 @multitable @columnfractions .15 .80
6711 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
6712 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
6713 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
6714 @code{INTEGER}. It is @code{INTENT(IN)}.
6715 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
6716 integer. It has @code{INTENT(OUT)}.
6719 @item @emph{Return value}:
6720 The @code{SIGNAL} functions returns the value returned by @code{signal(2)}.
6722 @item @emph{Example}:
6726 external handler_print
6728 call signal (12, handler_print)
6732 end program test_signal
6740 @section @code{SIN} --- Sine function
6741 @findex @code{SIN} intrinsic
6742 @findex @code{DSIN} intrinsic
6743 @findex @code{ZSIN} intrinsic
6744 @findex @code{CDSIN} intrinsic
6745 @cindex trigonometric functions
6748 @item @emph{Description}:
6749 @code{SIN(X)} computes the sine of @var{X}.
6751 @item @emph{Standard}:
6757 @item @emph{Syntax}:
6760 @item @emph{Arguments}:
6761 @multitable @columnfractions .15 .80
6762 @item @var{X} @tab The type shall be @code{REAL(*)} or
6766 @item @emph{Return value}:
6767 The return value has same type and kind as @var{X}.
6769 @item @emph{Example}:
6774 end program test_sin
6777 @item @emph{Specific names}:
6778 @multitable @columnfractions .20 .20 .20 .40
6779 @item Name @tab Argument @tab Return type @tab Standard
6780 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
6781 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
6782 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
6783 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
6786 @item @emph{See also}:
6793 @section @code{SINH} --- Hyperbolic sine function
6794 @findex @code{SINH} intrinsic
6795 @findex @code{DSINH} intrinsic
6796 @cindex hyperbolic sine
6799 @item @emph{Description}:
6800 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
6802 @item @emph{Standard}:
6808 @item @emph{Syntax}:
6811 @item @emph{Arguments}:
6812 @multitable @columnfractions .15 .80
6813 @item @var{X} @tab The type shall be @code{REAL(*)}.
6816 @item @emph{Return value}:
6817 The return value is of type @code{REAL(*)}.
6819 @item @emph{Example}:
6822 real(8) :: x = - 1.0_8
6824 end program test_sinh
6827 @item @emph{Specific names}:
6828 @multitable @columnfractions .20 .20 .20 .40
6829 @item Name @tab Argument @tab Return type @tab Standard
6830 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
6833 @item @emph{See also}:
6840 @section @code{SIZE} --- Determine the size of an array
6841 @findex @code{SIZE} intrinsic
6842 @cindex array manipulation
6844 Intrinsic implemented, documentation pending.
6847 @item @emph{Description}:
6848 @item @emph{Standard}:
6854 @item @emph{Syntax}:
6855 @item @emph{Arguments}:
6856 @item @emph{Return value}:
6857 @item @emph{Example}:
6858 @item @emph{See also}:
6864 @section @code{SNGL} --- Convert double precision real to default real
6865 @findex @code{SNGL} intrinsic
6866 @cindex conversion function (real)
6869 @item @emph{Description}:
6870 @code{SNGL(A)} converts the double precision real @var{A}
6871 to a default real value. This is an archaic form of @code{REAL}
6872 that is specific to one type for @var{A}.
6874 @item @emph{Standard}:
6880 @item @emph{Syntax}:
6883 @item @emph{Arguments}:
6884 @multitable @columnfractions .15 .80
6885 @item @var{A} @tab The type shall be a double precision @code{REAL}.
6888 @item @emph{Return value}:
6889 The return value is of type default @code{REAL}.
6891 @item @emph{See also}:
6898 @section @code{SPACING} --- Smallest distance between two numbers of a given type
6899 @findex @code{SPACING} intrinsic
6900 @cindex undocumented intrinsic
6902 Intrinsic implemented, documentation pending.
6905 @item @emph{Description}:
6906 @item @emph{Standard}:
6912 @item @emph{Syntax}:
6913 @item @emph{Arguments}:
6914 @item @emph{Return value}:
6915 @item @emph{Example}:
6916 @item @emph{See also}:
6923 @section @code{SPREAD} --- Add a dimension to an array
6924 @findex @code{SPREAD} intrinsic
6925 @cindex array manipulation
6927 Intrinsic implemented, documentation pending.
6930 @item @emph{Description}:
6931 @item @emph{Standard}:
6935 Transformational function
6937 @item @emph{Syntax}:
6938 @item @emph{Arguments}:
6939 @item @emph{Return value}:
6940 @item @emph{Example}:
6941 @item @emph{See also}:
6948 @section @code{SQRT} --- Square-root function
6949 @findex @code{SQRT} intrinsic
6950 @findex @code{DSQRT} intrinsic
6951 @findex @code{CSQRT} intrinsic
6952 @findex @code{ZSQRT} intrinsic
6953 @findex @code{CDSQRT} intrinsic
6957 @item @emph{Description}:
6958 @code{SQRT(X)} computes the square root of @var{X}.
6960 @item @emph{Standard}:
6966 @item @emph{Syntax}:
6969 @item @emph{Arguments}:
6970 @multitable @columnfractions .15 .80
6971 @item @var{X} @tab The type shall be @code{REAL(*)} or
6975 @item @emph{Return value}:
6976 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
6977 The kind type parameter is the same as @var{X}.
6979 @item @emph{Example}:
6982 real(8) :: x = 2.0_8
6983 complex :: z = (1.0, 2.0)
6986 end program test_sqrt
6989 @item @emph{Specific names}:
6990 @multitable @columnfractions .20 .20 .20 .40
6991 @item Name @tab Argument @tab Return type @tab Standard
6992 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
6993 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F95 and later
6994 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
6995 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7002 @section @code{SRAND} --- Reinitialize the random number generator
7003 @findex @code{SRAND} intrinsic
7004 @cindex random number
7007 @item @emph{Description}:
7008 @code{SRAND} reinitializes the pseudo-random number generator
7009 called by @code{RAND} and @code{IRAND}. The new seed used by the
7010 generator is specified by the required argument @var{SEED}.
7012 @item @emph{Standard}:
7016 non-elemental subroutine
7018 @item @emph{Syntax}:
7019 @code{CALL SRAND(SEED)}
7021 @item @emph{Arguments}:
7022 @multitable @columnfractions .15 .80
7023 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7026 @item @emph{Return value}:
7029 @item @emph{Example}:
7030 See @code{RAND} and @code{IRAND} for examples.
7033 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7034 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7035 to generate pseudo-random numbers. Please note that in
7036 @command{gfortran}, these two sets of intrinsics (@code{RAND},
7037 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7038 @code{RANDOM_SEED} on the other hand) access two independent
7039 pseudo-random number generators.
7041 @item @emph{See also}:
7042 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7048 @section @code{STAT} --- Get file status
7049 @findex @code{STAT} intrinsic
7050 @cindex file system operations
7052 Intrinsic implemented, documentation pending.
7055 @item @emph{Description}:
7056 @item @emph{Standard}:
7060 @item @emph{Syntax}:
7061 @item @emph{Arguments}:
7062 @item @emph{Return value}:
7063 @item @emph{Example}:
7064 @item @emph{See also}:
7072 @section @code{SUM} --- Sum of array elements
7073 @findex @code{SUM} intrinsic
7074 @cindex array manipulation
7076 Intrinsic implemented, documentation pending.
7079 @item @emph{Description}:
7080 @item @emph{Standard}:
7084 Transformational function
7086 @item @emph{Syntax}:
7087 @item @emph{Arguments}:
7088 @item @emph{Return value}:
7089 @item @emph{Example}:
7090 @item @emph{See also}:
7098 @section @code{SYMLNK} --- Create a symbolic link
7099 @findex @code{SYMLNK} intrinsic
7100 @cindex file system operations
7102 Intrinsic implemented, documentation pending.
7105 @item @emph{Description}:
7106 @item @emph{Standard}:
7110 @item @emph{Syntax}:
7111 @item @emph{Arguments}:
7112 @item @emph{Return value}:
7113 @item @emph{Example}:
7114 @item @emph{See also}:
7121 @section @code{SYSTEM} --- Execute a shell command
7122 @findex @code{SYSTEM} intrinsic
7123 @cindex undocumented intrinsic
7125 Intrinsic implemented, documentation pending.
7128 @item @emph{Description}:
7129 @item @emph{Standard}:
7135 @item @emph{Syntax}:
7136 @item @emph{Arguments}:
7137 @item @emph{Return value}:
7138 @item @emph{Example}:
7139 @item @emph{See also}:
7146 @section @code{SYSTEM_CLOCK} --- Time function
7147 @findex @code{SYSTEM_CLOCK} intrinsic
7148 @cindex time functions
7150 Intrinsic implemented, documentation pending.
7153 @item @emph{Description}:
7154 @item @emph{Standard}:
7160 @item @emph{Syntax}:
7161 @item @emph{Arguments}:
7162 @item @emph{Return value}:
7163 @item @emph{Example}:
7164 @item @emph{See also}:
7170 @section @code{TAN} --- Tangent function
7171 @findex @code{TAN} intrinsic
7172 @findex @code{DTAN} intrinsic
7173 @cindex trigonometric functions
7176 @item @emph{Description}:
7177 @code{TAN(X)} computes the tangent of @var{X}.
7179 @item @emph{Standard}:
7185 @item @emph{Syntax}:
7188 @item @emph{Arguments}:
7189 @multitable @columnfractions .15 .80
7190 @item @var{X} @tab The type shall be @code{REAL(*)}.
7193 @item @emph{Return value}:
7194 The return value is of type @code{REAL(*)}. The kind type parameter is
7195 the same as @var{X}.
7197 @item @emph{Example}:
7200 real(8) :: x = 0.165_8
7202 end program test_tan
7205 @item @emph{Specific names}:
7206 @multitable @columnfractions .20 .20 .20 .40
7207 @item Name @tab Argument @tab Return type @tab Standard
7208 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7211 @item @emph{See also}:
7218 @section @code{TANH} --- Hyperbolic tangent function
7219 @findex @code{TANH} intrinsic
7220 @findex @code{DTANH} intrinsic
7221 @cindex hyperbolic tangent
7224 @item @emph{Description}:
7225 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
7227 @item @emph{Standard}:
7233 @item @emph{Syntax}:
7236 @item @emph{Arguments}:
7237 @multitable @columnfractions .15 .80
7238 @item @var{X} @tab The type shall be @code{REAL(*)}.
7241 @item @emph{Return value}:
7242 The return value is of type @code{REAL(*)} and lies in the range
7243 @math{ - 1 \leq tanh(x) \leq 1 }.
7245 @item @emph{Example}:
7248 real(8) :: x = 2.1_8
7250 end program test_tanh
7253 @item @emph{Specific names}:
7254 @multitable @columnfractions .20 .20 .20 .40
7255 @item Name @tab Argument @tab Return type @tab Standard
7256 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7259 @item @emph{See also}:
7266 @section @code{TIME} --- Time function
7267 @findex @code{TIME} intrinsic
7268 @cindex time functions
7270 Intrinsic implemented, documentation pending.
7273 @item @emph{Description}:
7274 @item @emph{Standard}:
7278 Non-elemental function
7280 @item @emph{Syntax}:
7281 @item @emph{Arguments}:
7282 @item @emph{Return value}:
7283 @item @emph{Example}:
7284 @item @emph{See also}:
7290 @section @code{TINY} --- Smallest positive number of a real kind
7291 @findex @code{TINY} intrinsic
7295 @item @emph{Description}:
7296 @code{TINY(X)} returns the smallest positive (non zero) number
7297 in the model of the type of @code{X}.
7299 @item @emph{Standard}:
7305 @item @emph{Syntax}:
7308 @item @emph{Arguments}:
7309 @multitable @columnfractions .15 .80
7310 @item @var{X} @tab shall be of type @code{REAL}.
7313 @item @emph{Return value}:
7314 The return value is of the same type and kind as @var{X}
7316 @item @emph{Example}:
7317 See @code{HUGE} for an example.
7323 @section @code{TRANSFER} --- Transfer bit patterns
7324 @findex @code{TRANSFER} intrinsic
7325 @cindex bit manipulation
7327 Intrinsic implemented, documentation pending.
7330 @item @emph{Description}:
7331 @item @emph{Standard}:
7335 Transformational function
7337 @item @emph{Syntax}:
7338 @item @emph{Arguments}:
7339 @item @emph{Return value}:
7340 @item @emph{Example}:
7341 @item @emph{See also}:
7348 @section @code{TRANSPOSE} --- Transpose an array of rank two
7349 @findex @code{TRANSPOSE} intrinsic
7350 @cindex matrix manipulation
7352 Intrinsic implemented, documentation pending.
7355 @item @emph{Description}:
7356 @item @emph{Standard}:
7360 Transformational function
7362 @item @emph{Syntax}:
7363 @item @emph{Arguments}:
7364 @item @emph{Return value}:
7365 @item @emph{Example}:
7366 @item @emph{See also}:
7373 @section @code{TRIM} --- Function to remove trailing blank characters of a string
7374 @findex @code{TRIM} intrinsic
7375 @cindex string manipulation
7377 Intrinsic implemented, documentation pending.
7380 @item @emph{Description}:
7381 @item @emph{Standard}:
7385 Transformational function
7387 @item @emph{Syntax}:
7388 @item @emph{Arguments}:
7389 @item @emph{Return value}:
7390 @item @emph{Example}:
7391 @item @emph{See also}:
7398 @section @code{UBOUND} --- Upper dimension bounds of an array
7399 @findex @code{UBOUND} intrinsic
7400 @cindex undocumented intrinsic
7402 Intrinsic implemented, documentation pending.
7405 @item @emph{Description}:
7407 @item @emph{Standard}:
7413 @item @emph{Syntax}:
7414 @item @emph{Arguments}:
7415 @item @emph{Return value}:
7416 @item @emph{Example}:
7417 @item @emph{Specific names}:
7419 @item @emph{See also}:
7427 @section @code{UMASK} --- Set the file creation mask
7428 @findex @code{UMASK} intrinsic
7429 @cindex file system operations
7431 Intrinsic implemented, documentation pending.
7434 @item @emph{Description}:
7435 @item @emph{Standard}:
7441 @item @emph{Syntax}:
7442 @item @emph{Arguments}:
7443 @item @emph{Return value}:
7444 @item @emph{Example}:
7445 @item @emph{Specific names}:
7446 @item @emph{See also}:
7453 @section @code{UNLINK} --- Remove a file from the file system
7454 @findex @code{UNLINK} intrinsic
7455 @cindex file system operations
7457 Intrinsic implemented, documentation pending.
7460 @item @emph{Description}:
7461 @item @emph{Standard}:
7467 @item @emph{Syntax}:
7468 @item @emph{Arguments}:
7469 @item @emph{Return value}:
7470 @item @emph{Example}:
7472 @item @emph{See also}:
7480 @section @code{UNMASK} --- (?)
7481 @findex @code{UNMASK} intrinsic
7482 @cindex undocumented intrinsic
7484 Intrinsic implemented, documentation pending.
7487 @item @emph{Description}:
7488 @item @emph{Standard}:
7490 @item @emph{Syntax}:
7491 @item @emph{Arguments}:
7492 @item @emph{Return value}:
7493 @item @emph{Example}:
7494 @item @emph{Specific names}:
7495 @item @emph{See also}:
7502 @section @code{UNPACK} --- Unpack an array of rank one into an array
7503 @findex @code{UNPACK} intrinsic
7504 @cindex array manipulation
7506 Intrinsic implemented, documentation pending.
7509 @item @emph{Description}:
7510 @item @emph{Standard}:
7514 Transformational function
7516 @item @emph{Syntax}:
7517 @item @emph{Arguments}:
7518 @item @emph{Return value}:
7519 @item @emph{Example}:
7521 @item @emph{See also}:
7529 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
7530 @findex @code{VERIFY} intrinsic
7531 @cindex string manipulation
7533 Intrinsic implemented, documentation pending.
7536 @item @emph{Description}:
7537 @item @emph{Standard}:
7543 @item @emph{Syntax}:
7544 @item @emph{Arguments}:
7545 @item @emph{Return value}:
7546 @item @emph{Example}:
7547 @item @emph{Specific names}:
7548 @item @emph{See also}:
7555 @section @code{XOR} --- Logical exclusive or
7556 @findex @code{XOR} intrinsic
7557 @cindex logical operations
7559 Intrinsic implemented, documentation pending.
7562 @item @emph{Description}:
7563 @item @emph{Standard}:
7567 @item @emph{Syntax}:
7568 @item @emph{Arguments}:
7569 @item @emph{Return value}:
7570 @item @emph{Example}:
7571 @item @emph{Specific names}:
7572 @item @emph{See also}: