2 Copyright (C) 2005, 2006
3 Free Software Foundation, Inc.
4 This is part of the GNU Fortran manual.
5 For copying conditions, see the file gfortran.texi.
7 Permission is granted to copy, distribute and/or modify this document
8 under the terms of the GNU Free Documentation License, Version 1.2 or
9 any later version published by the Free Software Foundation; with the
10 Invariant Sections being ``GNU General Public License'' and ``Funding
11 Free Software'', the Front-Cover texts being (a) (see below), and with
12 the Back-Cover Texts being (b) (see below). A copy of the license is
13 included in the gfdl(7) man page.
16 Some basic guidelines for editing this document:
18 (1) The intrinsic procedures are to be listed in alphabetical order.
19 (2) The generic name is to be use.
20 (3) The specific names are included in the function index and in a
21 table at the end of the node (See ABS entry).
22 (4) Try to maintain the same style for each entry.
28 \gdef\acos{\mathop{\rm acos}\nolimits}
29 \gdef\asin{\mathop{\rm asin}\nolimits}
30 \gdef\atan{\mathop{\rm atan}\nolimits}
31 \gdef\acosh{\mathop{\rm acosh}\nolimits}
32 \gdef\asinh{\mathop{\rm asinh}\nolimits}
33 \gdef\atanh{\mathop{\rm atanh}\nolimits}
37 @node Intrinsic Procedures
38 @chapter Intrinsic Procedures
39 @cindex Intrinsic Procedures
41 This portion of the document is incomplete and undergoing massive expansion
42 and editing. All contributions and corrections are strongly encouraged.
44 Implemented intrinsics are fully functional and available to the user to apply.
45 Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.
48 * Introduction: Introduction
49 * @code{ABORT}: ABORT, Abort the program
50 * @code{ABS}: ABS, Absolute value
51 * @code{ACCESS}: ACCESS, Checks file access method
52 * @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
53 * @code{ACOS}: ACOS, Arccosine function
54 * @code{ACOSH}: ACOSH, Hyperbolic arccosine function
55 * @code{ADJUSTL}: ADJUSTL, Left adjust a string
56 * @code{ADJUSTR}: ADJUSTR, Right adjust a string
57 * @code{AIMAG}: AIMAG, Imaginary part of complex number
58 * @code{AINT}: AINT, Truncate to a whole number
59 * @code{ALARM}: ALARM, Set an alarm clock
60 * @code{ALL}: ALL, Determine if all values are true
61 * @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
62 * @code{AND}: AND, Bitwise logical AND
63 * @code{ANINT}: ANINT, Nearest whole number
64 * @code{ANY}: ANY, Determine if any values are true
65 * @code{ASIN}: ASIN, Arcsine function
66 * @code{ASINH}: ASINH, Hyperbolic arcsine function
67 * @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
68 * @code{ATAN}: ATAN, Arctangent function
69 * @code{ATAN2}: ATAN2, Arctangent function
70 * @code{ATANH}: ATANH, Hyperbolic arctangent function
71 * @code{BESJ0}: BESJ0, Bessel function of the first kind of order 0
72 * @code{BESJ1}: BESJ1, Bessel function of the first kind of order 1
73 * @code{BESJN}: BESJN, Bessel function of the first kind
74 * @code{BESY0}: BESY0, Bessel function of the second kind of order 0
75 * @code{BESY1}: BESY1, Bessel function of the second kind of order 1
76 * @code{BESYN}: BESYN, Bessel function of the second kind
77 * @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
78 * @code{BTEST}: BTEST, Bit test function
79 * @code{CEILING}: CEILING, Integer ceiling function
80 * @code{CHAR}: CHAR, Integer-to-character conversion function
81 * @code{CHDIR}: CHDIR, Change working directory
82 * @code{CHMOD}: CHMOD, Change access permissions of files
83 * @code{CMPLX}: CMPLX, Complex conversion function
84 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Command line argument count
85 * @code{CONJG}: CONJG, Complex conjugate function
86 * @code{COS}: COS, Cosine function
87 * @code{COSH}: COSH, Hyperbolic cosine function
88 * @code{COUNT}: COUNT, Count occurrences of TRUE in an array
89 * @code{CPU_TIME}: CPU_TIME, CPU time subroutine
90 * @code{CSHIFT}: CSHIFT, Circular array shift function
91 * @code{CTIME}: CTIME, Subroutine (or function) to convert a time into a string
92 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
93 * @code{DBLE}: DBLE, Double precision conversion function
94 * @code{DCMPLX}: DCMPLX, Double complex conversion function
95 * @code{DFLOAT}: DFLOAT, Double precision conversion function
96 * @code{DIGITS}: DIGITS, Significant digits function
97 * @code{DIM}: DIM, Dim function
98 * @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
99 * @code{DPROD}: DPROD, Double product function
100 * @code{DREAL}: DREAL, Double real part function
101 * @code{DTIME}: DTIME, Execution time subroutine (or function)
102 * @code{EOSHIFT}: EOSHIFT, End-off shift function
103 * @code{EPSILON}: EPSILON, Epsilon function
104 * @code{ERF}: ERF, Error function
105 * @code{ERFC}: ERFC, Complementary error function
106 * @code{ETIME}: ETIME, Execution time subroutine (or function)
107 * @code{EXIT}: EXIT, Exit the program with status.
108 * @code{EXP}: EXP, Exponential function
109 * @code{EXPONENT}: EXPONENT, Exponent function
110 * @code{FDATE}: FDATE, Subroutine (or function) to get the current time as a string
111 * @code{FGET}: FGET, Read a single character in stream mode from stdin
112 * @code{FGETC}: FGETC, Read a single character in stream mode
113 * @code{FLOAT}: FLOAT, Convert integer to default real
114 * @code{FLOOR}: FLOOR, Integer floor function
115 * @code{FLUSH}: FLUSH, Flush I/O unit(s)
116 * @code{FNUM}: FNUM, File number function
117 * @code{FPUT}: FPUT, Write a single character in stream mode to stdout
118 * @code{FPUTC}: FPUTC, Write a single character in stream mode
119 * @code{FRACTION}: FRACTION, Fractional part of the model representation
120 * @code{FREE}: FREE, Memory de-allocation subroutine
121 * @code{FSEEK}: FSEEK, Low level file positioning subroutine
122 * @code{FSTAT}: FSTAT, Get file status
123 * @code{FTELL}: FTELL, Current stream position
124 * @code{GETARG}: GETARG, Get command line arguments
125 * @code{GET_COMMAND}: GET_COMMAND, Subroutine to retrieve the entire command line
126 * @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Subroutine to retrieve a command argument
127 * @code{GETCWD}: GETCWD, Get current working directory
128 * @code{GETENV}: GETENV, Get an environmental variable
129 * @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
130 * @code{GETGID}: GETGID, Group ID function
131 * @code{GETLOG}: GETLOG, Get login name
132 * @code{GETPID}: GETPID, Process ID function
133 * @code{GETUID}: GETUID, User ID function
134 * @code{GMTIME}: GMTIME, Convert time to GMT info
135 * @code{HOSTNM}: HOSTNM, Get system host name
136 * @code{HUGE}: HUGE, Largest number of a kind
137 * @code{IACHAR}: IACHAR, Code in @acronym{ASCII} collating sequence
138 * @code{IAND}: IAND, Bitwise logical and
139 * @code{IARGC}: IARGC, Get number of command line arguments
140 * @code{IBCLR}: IBCLR, Clear bit
141 * @code{IBITS}: IBITS, Bit extraction
142 * @code{IBSET}: IBSET, Set bit
143 * @code{ICHAR}: ICHAR, Character-to-integer conversion function
144 * @code{IDATE}: IDATE, Current local time (day/month/year)
145 * @code{IEOR}: IEOR, Bitwise logical exclusive or
146 * @code{IERRNO}: IERRNO, Function to get the last system error number
147 * @code{INDEX}: INDEX, Position of a substring within a string
148 * @code{INT}: INT, Convert to integer type
149 * @code{IOR}: IOR, Bitwise logical or
150 * @code{IRAND}: IRAND, Integer pseudo-random number
151 * @code{ISHFT}: ISHFT, Shift bits
152 * @code{ISHFTC}: ISHFTC, Shift bits circularly
153 * @code{ITIME}: ITIME, Current local time (hour/minutes/seconds)
154 * @code{KILL}: KILL, Send a signal to a process
155 * @code{KIND}: KIND, Kind of an entity
156 * @code{LBOUND}: LBOUND, Lower dimension bounds of an array
157 * @code{LEN}: LEN, Length of a character entity
158 * @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
159 * @code{LGE}: LGE, Lexical greater than or equal
160 * @code{LGT}: LGT, Lexical greater than
161 * @code{LINK}: LINK, Create a hard link
162 * @code{LLE}: LLE, Lexical less than or equal
163 * @code{LLT}: LLT, Lexical less than
164 * @code{LNBLNK}: LNBLNK, Index of the last non-blank character in a string
165 * @code{LOC}: LOC, Returns the address of a variable
166 * @code{LOG}: LOG, Logarithm function
167 * @code{LOG10}: LOG10, Base 10 logarithm function
168 * @code{LOGICAL}: LOGICAL, Convert to logical type
169 * @code{LSHIFT}: LSHIFT, Left shift bits
170 * @code{LTIME}: LTIME, Convert time to local time info
171 * @code{MALLOC}: MALLOC, Dynamic memory allocation function
172 * @code{MATMUL}: MATMUL, matrix multiplication
173 * @code{MAX}: MAX, Maximum value of an argument list
174 * @code{MAXEXPONENT}: MAXEXPONENT, Maximum exponent of a real kind
175 * @code{MAXLOC}: MAXLOC, Location of the maximum value within an array
176 * @code{MAXVAL}: MAXVAL, Maximum value of an array
177 * @code{MERGE}: MERGE, Merge arrays
178 * @code{MIN}: MIN, Minimum value of an argument list
179 * @code{MINEXPONENT}: MINEXPONENT, Minimum exponent of a real kind
180 * @code{MINLOC}: MINLOC, Location of the minimum value within an array
181 * @code{MINVAL}: MINVAL, Minimum value of an array
182 * @code{MOD}: MOD, Remainder function
183 * @code{MODULO}: MODULO, Modulo function
184 * @code{MVBITS}: MVBITS, Move bits from one integer to another
185 * @code{NEAREST}: NEAREST, Nearest representable number
186 * @code{NINT}: NINT, Nearest whole number
187 * @code{NOT}: NOT, Logical negation
188 * @code{NULL}: NULL, Function that returns an disassociated pointer
189 * @code{OR}: OR, Bitwise logical OR
190 * @code{PACK}: PACK, Pack an array into an array of rank one
191 * @code{PERROR}: PERROR, Print system error message
192 * @code{PRECISION}: PRECISION, Decimal precision of a real kind
193 * @code{PRESENT}: PRESENT, Determine whether an optional argument is specified
194 * @code{PRODUCT}: PRODUCT, Product of array elements
195 * @code{RADIX}: RADIX, Base of a data model
196 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
197 * @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence
198 * @code{RAND}: RAND, Real pseudo-random number
199 * @code{RANGE}: RANGE, Decimal exponent range of a real kind
200 * @code{RAN}: RAN, Real pseudo-random number
201 * @code{REAL}: REAL, Convert to real type
202 * @code{RENAME}: RENAME, Rename a file
203 * @code{REPEAT}: REPEAT, Repeated string concatenation
204 * @code{RESHAPE}: RESHAPE, Function to reshape an array
205 * @code{RRSPACING}: RRSPACING, Reciprocal of the relative spacing
206 * @code{RSHIFT}: RSHIFT, Right shift bits
207 * @code{SCALE}: SCALE, Scale a real value
208 * @code{SCAN}: SCAN, Scan a string for the presence of a set of characters
209 * @code{SECNDS}: SECNDS, Time function
210 @comment * @code{SECOND}: SECOND, (?)
211 @comment * @code{SECONDS}: SECONDS, (?)
212 * @code{SELECTED_INT_KIND}: SELECTED_INT_KIND, Choose integer kind
213 * @code{SELECTED_REAL_KIND}: SELECTED_REAL_KIND, Choose real kind
214 * @code{SET_EXPONENT}: SET_EXPONENT, Set the exponent of the model
215 * @code{SHAPE}: SHAPE, Determine the shape of an array
216 * @code{SIGN}: SIGN, Sign copying function
217 * @code{SIGNAL}: SIGNAL, Signal handling subroutine (or function)
218 * @code{SIN}: SIN, Sine function
219 * @code{SINH}: SINH, Hyperbolic sine function
220 * @code{SIZE}: SIZE, Function to determine the size of an array
221 * @code{SNGL}: SNGL, Convert double precision real to default real
222 * @code{SPACING}: SPACING, Smallest distance between two numbers of a given type
223 * @code{SPREAD}: SPREAD, Add a dimension to an array
224 * @code{SQRT}: SQRT, Square-root function
225 * @code{SRAND}: SRAND, Reinitialize the random number generator
226 * @code{STAT}: STAT, Get file status
227 * @code{SUM}: SUM, Sum of array elements
228 * @code{SYMLNK}: SYMLNK, Create a symbolic link
229 * @code{SYSTEM}: SYSTEM, Execute a shell command
230 * @code{SYSTEM_CLOCK}: SYSTEM_CLOCK, Time function
231 * @code{TAN}: TAN, Tangent function
232 * @code{TANH}: TANH, Hyperbolic tangent function
233 * @code{TIME}: TIME, Time function
234 * @code{TINY}: TINY, Smallest positive number of a real kind
235 * @code{TRANSFER}: TRANSFER, Transfer bit patterns
236 * @code{TRANSPOSE}: TRANSPOSE, Transpose an array of rank two
237 * @code{TRIM}: TRIM, Function to remove trailing blank characters of a string
238 * @code{UBOUND}: UBOUND, Upper dimension bounds of an array
239 * @code{UMASK}: UMASK, Set the file creation mask
240 * @code{UNLINK}: UNLINK, Remove a file from the file system
241 * @code{UNMASK}: UNMASK, (?)
242 * @code{UNPACK}: UNPACK, Unpack an array of rank one into an array
243 * @code{VERIFY}: VERIFY, Scan a string for the absence of a set of characters
244 * @code{XOR}: XOR, Bitwise logical exclusive or
248 @section Introduction to intrinsic procedures
250 GNU Fortran provides a rich set of intrinsic procedures that includes all
251 the intrinsic procedures required by the Fortran 95 standard, a set of
252 intrinsic procedures for backwards compatibility with Gnu Fortran 77
253 (i.e., @command{g77}), and a small selection of intrinsic procedures
254 from the Fortran 2003 standard. Any description here, which conflicts with a
255 description in either the Fortran 95 standard or the Fortran 2003 standard,
256 is unintentional and the standard(s) should be considered authoritative.
258 The enumeration of the @code{KIND} type parameter is processor defined in
259 the Fortran 95 standard. GNU Fortran defines the default integer type and
260 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
261 respectively. The standard mandates that both data types shall have
262 another kind, which have more precision. On typical target architectures
263 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
264 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
265 In the description of generic intrinsic procedures, the kind type parameter
266 will be specified by @code{KIND=*}, and in the description of specific
267 names for an intrinsic procedure the kind type parameter will be explicitly
268 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
269 brevity the optional @code{KIND=} syntax will be omitted.
271 Many of the intrinsics procedures take one or more optional arguments.
272 This document follows the convention used in the Fortran 95 standard,
273 and denotes such arguments by square brackets.
275 GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
276 which can be used to restrict the set of intrinsic procedures to a
277 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
278 option, and so all intrinsic procedures described here are accepted. There
279 is one caveat. For a select group of intrinsic procedures, @command{g77}
280 implemented both a function and a subroutine. Both classes
281 have been implemented in @command{gfortran} for backwards compatibility
282 with @command{g77}. It is noted here that these functions and subroutines
283 cannot be intermixed in a given subprogram. In the descriptions that follow,
284 the applicable option(s) is noted.
289 @section @code{ABORT} --- Abort the program
290 @findex @code{ABORT} intrinsic
294 @item @emph{Description}:
295 @code{ABORT} causes immediate termination of the program. On operating
296 systems that support a core dump, @code{ABORT} will produce a core dump,
297 which is suitable for debugging purposes.
299 @item @emph{Standard}:
303 non-elemental subroutine
308 @item @emph{Return value}:
311 @item @emph{Example}:
314 integer :: i = 1, j = 2
315 if (i /= j) call abort
316 end program test_abort
319 @item @emph{See also}:
320 @ref{EXIT}, @ref{KILL}
327 @section @code{ABS} --- Absolute value
328 @findex @code{ABS} intrinsic
329 @findex @code{CABS} intrinsic
330 @findex @code{DABS} intrinsic
331 @findex @code{IABS} intrinsic
332 @findex @code{ZABS} intrinsic
333 @findex @code{CDABS} intrinsic
334 @cindex absolute value
337 @item @emph{Description}:
338 @code{ABS(X)} computes the absolute value of @code{X}.
340 @item @emph{Standard}:
341 F77 and later, has overloads that are GNU extensions
349 @item @emph{Arguments}:
350 @multitable @columnfractions .15 .80
351 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
352 @code{REAL(*)}, or @code{COMPLEX(*)}.
355 @item @emph{Return value}:
356 The return value is of the same type and
357 kind as the argument except the return value is @code{REAL(*)} for a
358 @code{COMPLEX(*)} argument.
360 @item @emph{Example}:
365 complex :: z = (-1.e0,0.e0)
372 @item @emph{Specific names}:
373 @multitable @columnfractions .20 .20 .20 .40
374 @item Name @tab Argument @tab Return type @tab Standard
375 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab F77 and later
376 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
377 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
378 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
379 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
385 @section @code{ACCESS} --- Checks file access method
386 @findex @code{ACCESS}
387 @cindex file system functions
389 Not yet implemented in GNU Fortran.
392 @item @emph{Description}:
394 @item @emph{Standard}:
399 @item @emph{Arguments}:
400 @item @emph{Return value}:
401 @item @emph{Example}:
402 @item @emph{Specific names}:
403 @item @emph{See also}:
404 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
410 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
411 @findex @code{ACHAR} intrinsic
412 @cindex @acronym{ASCII} collating sequence
415 @item @emph{Description}:
416 @code{ACHAR(I)} returns the character located at position @code{I}
417 in the @acronym{ASCII} collating sequence.
419 @item @emph{Standard}:
428 @item @emph{Arguments}:
429 @multitable @columnfractions .15 .80
430 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
433 @item @emph{Return value}:
434 The return value is of type @code{CHARACTER} with a length of one. The
435 kind type parameter is the same as @code{KIND('A')}.
437 @item @emph{Example}:
442 end program test_achar
449 @section @code{ACOS} --- Arccosine function
450 @findex @code{ACOS} intrinsic
451 @findex @code{DACOS} intrinsic
452 @cindex trigonometric functions (inverse)
455 @item @emph{Description}:
456 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
458 @item @emph{Standard}:
467 @item @emph{Arguments}:
468 @multitable @columnfractions .15 .80
469 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
473 @item @emph{Return value}:
474 The return value is of type @code{REAL(*)} and it lies in the
475 range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter
476 is the same as @var{X}.
478 @item @emph{Example}:
481 real(8) :: x = 0.866_8
483 end program test_acos
486 @item @emph{Specific names}:
487 @multitable @columnfractions .20 .20 .20 .40
488 @item Name @tab Argument @tab Return type @tab Standard
489 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
492 @item @emph{See also}:
493 Inverse function: @ref{COS}
499 @section @code{ACOSH} --- Hyperbolic arccosine function
500 @findex @code{ACOSH} intrinsic
501 @cindex hyperbolic arccosine
502 @cindex hyperbolic cosine (inverse)
505 @item @emph{Description}:
506 @code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
508 @item @emph{Standard}:
517 @item @emph{Arguments}:
518 @multitable @columnfractions .15 .80
519 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
520 greater or equal to one.
523 @item @emph{Return value}:
524 The return value is of type @code{REAL(*)} and it lies in the
525 range @math{0 \leq \acosh (x) \leq \infty}.
527 @item @emph{Example}:
530 REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
535 @item @emph{See also}:
536 Inverse function: @ref{COSH}
542 @section @code{ADJUSTL} --- Left adjust a string
543 @findex @code{ADJUSTL} intrinsic
544 @cindex adjust string
547 @item @emph{Description}:
548 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
549 Spaces are inserted at the end of the string as needed.
551 @item @emph{Standard}:
558 @code{STR = ADJUSTL(STR)}
560 @item @emph{Arguments}:
561 @multitable @columnfractions .15 .80
562 @item @var{STR} @tab The type shall be @code{CHARACTER}.
565 @item @emph{Return value}:
566 The return value is of type @code{CHARACTER} where leading spaces
567 are removed and the same number of spaces are inserted on the end
570 @item @emph{Example}:
573 character(len=20) :: str = ' gfortran'
576 end program test_adjustl
583 @section @code{ADJUSTR} --- Right adjust a string
584 @findex @code{ADJUSTR} intrinsic
585 @cindex adjust string
588 @item @emph{Description}:
589 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
590 Spaces are inserted at the start of the string as needed.
592 @item @emph{Standard}:
599 @code{STR = ADJUSTR(STR)}
601 @item @emph{Arguments}:
602 @multitable @columnfractions .15 .80
603 @item @var{STR} @tab The type shall be @code{CHARACTER}.
606 @item @emph{Return value}:
607 The return value is of type @code{CHARACTER} where trailing spaces
608 are removed and the same number of spaces are inserted at the start
611 @item @emph{Example}:
614 character(len=20) :: str = 'gfortran'
617 end program test_adjustr
624 @section @code{AIMAG} --- Imaginary part of complex number
625 @findex @code{AIMAG} intrinsic
626 @findex @code{DIMAG} intrinsic
627 @findex @code{IMAG} intrinsic
628 @findex @code{IMAGPART} intrinsic
629 @cindex Imaginary part
632 @item @emph{Description}:
633 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
634 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
635 for compatibility with @command{g77}, and their use in new code is
636 strongly discouraged.
638 @item @emph{Standard}:
639 F77 and later, has overloads that are GNU extensions
647 @item @emph{Arguments}:
648 @multitable @columnfractions .15 .80
649 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
652 @item @emph{Return value}:
653 The return value is of type real with the
654 kind type parameter of the argument.
656 @item @emph{Example}:
661 z4 = cmplx(1.e0_4, 0.e0_4)
662 z8 = cmplx(0.e0_8, 1.e0_8)
663 print *, aimag(z4), dimag(z8)
664 end program test_aimag
667 @item @emph{Specific names}:
668 @multitable @columnfractions .20 .20 .20 .40
669 @item Name @tab Argument @tab Return type @tab Standard
670 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab F95 and later
671 @item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
672 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
679 @section @code{AINT} --- Truncate to a whole number
680 @findex @code{AINT} intrinsic
681 @findex @code{DINT} intrinsic
685 @item @emph{Description}:
686 @code{AINT(X [, KIND])} truncates its argument to a whole number.
688 @item @emph{Standard}:
696 @code{X = AINT(X, KIND)}
698 @item @emph{Arguments}:
699 @multitable @columnfractions .15 .80
700 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
701 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
702 initialization expression.
705 @item @emph{Return value}:
706 The return value is of type real with the kind type parameter of the
707 argument if the optional @var{KIND} is absent; otherwise, the kind
708 type parameter will be given by @var{KIND}. If the magnitude of
709 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
710 magnitude is equal to or greater than one, then it returns the largest
711 whole number that does not exceed its magnitude. The sign is the same
712 as the sign of @var{X}.
714 @item @emph{Example}:
721 print *, aint(x4), dint(x8)
723 end program test_aint
726 @item @emph{Specific names}:
727 @multitable @columnfractions .20 .20 .20 .40
728 @item Name @tab Argument @tab Return type @tab Standard
729 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
736 @section @code{ALARM} --- Execute a routine after a given delay
737 @findex @code{ALARM} intrinsic
740 @item @emph{Description}:
741 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
742 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
743 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
744 supplied, it will be returned with the number of seconds remaining until
745 any previously scheduled alarm was due to be delivered, or zero if there
746 was no previously scheduled alarm.
748 @item @emph{Standard}:
755 @code{CALL ALARM(SECONDS, HANDLER)}
756 @code{CALL ALARM(SECONDS, HANDLER, STATUS)}
758 @item @emph{Arguments}:
759 @multitable @columnfractions .15 .80
760 @item @var{SECONDS} @tab The type of the argument shall be a scalar
761 @code{INTEGER}. It is @code{INTENT(IN)}.
762 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
763 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
764 @code{INTEGER}. It is @code{INTENT(IN)}.
765 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
766 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
769 @item @emph{Example}:
772 external handler_print
774 call alarm (3, handler_print, i)
777 end program test_alarm
779 This will cause the external routine @var{handler_print} to be called
786 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
787 @findex @code{ALL} intrinsic
791 @item @emph{Description}:
792 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
793 in the array along dimension @var{DIM}.
795 @item @emph{Standard}:
799 transformational function
803 @code{L = ALL(MASK, DIM)}
805 @item @emph{Arguments}:
806 @multitable @columnfractions .15 .80
807 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
808 it shall not be scalar.
809 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
810 with a value that lies between one and the rank of @var{MASK}.
813 @item @emph{Return value}:
814 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
815 the kind type parameter is the same as the kind type parameter of
816 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
817 an array with the rank of @var{MASK} minus 1. The shape is determined from
818 the shape of @var{MASK} where the @var{DIM} dimension is elided.
822 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
823 It also is true if @var{MASK} has zero size; otherwise, it is false.
825 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
826 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
827 is determined by applying @code{ALL} to the array sections.
830 @item @emph{Example}:
834 l = all((/.true., .true., .true./))
839 integer a(2,3), b(2,3)
843 print *, all(a .eq. b, 1)
844 print *, all(a .eq. b, 2)
845 end subroutine section
853 @section @code{ALLOCATED} --- Status of an allocatable entity
854 @findex @code{ALLOCATED} intrinsic
855 @cindex allocation status
858 @item @emph{Description}:
859 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
861 @item @emph{Standard}:
868 @code{L = ALLOCATED(X)}
870 @item @emph{Arguments}:
871 @multitable @columnfractions .15 .80
872 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
875 @item @emph{Return value}:
876 The return value is a scalar @code{LOGICAL} with the default logical
877 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
878 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
880 @item @emph{Example}:
882 program test_allocated
884 real(4), allocatable :: x(:)
885 if (allocated(x) .eqv. .false.) allocate(x(i))
886 end program test_allocated
892 @section @code{AND} --- Bitwise logical AND
893 @findex @code{AND} intrinsic
894 @cindex bit operations
897 @item @emph{Description}:
898 Bitwise logical @code{AND}.
900 This intrinsic routine is provided for backwards compatibility with
901 GNU Fortran 77. For integer arguments, programmers should consider
902 the use of the @ref{IAND} intrinsic defined by the Fortran standard.
904 @item @emph{Standard}:
908 Non-elemental function
911 @code{RESULT = AND(X, Y)}
913 @item @emph{Arguments}:
914 @multitable @columnfractions .15 .80
915 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
916 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
919 @item @emph{Return value}:
920 The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
921 cross-promotion of the arguments.
923 @item @emph{Example}:
926 LOGICAL :: T = .TRUE., F = ..FALSE.
928 DATA a / Z'F' /, b / Z'3' /
930 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
931 WRITE (*,*) AND(a, b)
935 @item @emph{See also}:
936 F95 elemental function: @ref{IAND}
942 @section @code{ANINT} --- Nearest whole number
943 @findex @code{ANINT} intrinsic
944 @findex @code{DNINT} intrinsic
948 @item @emph{Description}:
949 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
951 @item @emph{Standard}:
959 @code{X = ANINT(X, KIND)}
961 @item @emph{Arguments}:
962 @multitable @columnfractions .15 .80
963 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
964 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
965 initialization expression.
968 @item @emph{Return value}:
969 The return value is of type real with the kind type parameter of the
970 argument if the optional @var{KIND} is absent; otherwise, the kind
971 type parameter will be given by @var{KIND}. If @var{X} is greater than
972 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
973 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
975 @item @emph{Example}:
982 print *, anint(x4), dnint(x8)
984 end program test_anint
987 @item @emph{Specific names}:
988 @multitable @columnfractions .20 .20 .20 .40
989 @item Name @tab Argument @tab Return type @tab Standard
990 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
997 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
998 @findex @code{ANY} intrinsic
1002 @item @emph{Description}:
1003 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1004 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
1006 @item @emph{Standard}:
1010 transformational function
1012 @item @emph{Syntax}:
1013 @code{L = ANY(MASK)}
1014 @code{L = ANY(MASK, DIM)}
1016 @item @emph{Arguments}:
1017 @multitable @columnfractions .15 .80
1018 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1019 it shall not be scalar.
1020 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
1021 with a value that lies between one and the rank of @var{MASK}.
1024 @item @emph{Return value}:
1025 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1026 the kind type parameter is the same as the kind type parameter of
1027 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1028 an array with the rank of @var{MASK} minus 1. The shape is determined from
1029 the shape of @var{MASK} where the @var{DIM} dimension is elided.
1033 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
1034 otherwise, it is false. It also is false if @var{MASK} has zero size.
1036 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1037 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
1038 is determined by applying @code{ANY} to the array sections.
1041 @item @emph{Example}:
1045 l = any((/.true., .true., .true./))
1050 integer a(2,3), b(2,3)
1054 print *, any(a .eq. b, 1)
1055 print *, any(a .eq. b, 2)
1056 end subroutine section
1057 end program test_any
1064 @section @code{ASIN} --- Arcsine function
1065 @findex @code{ASIN} intrinsic
1066 @findex @code{DASIN} intrinsic
1067 @cindex trigonometric functions (inverse)
1070 @item @emph{Description}:
1071 @code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
1073 @item @emph{Standard}:
1079 @item @emph{Syntax}:
1082 @item @emph{Arguments}:
1083 @multitable @columnfractions .15 .80
1084 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1088 @item @emph{Return value}:
1089 The return value is of type @code{REAL(*)} and it lies in the
1090 range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}. The kind type
1091 parameter is the same as @var{X}.
1093 @item @emph{Example}:
1096 real(8) :: x = 0.866_8
1098 end program test_asin
1101 @item @emph{Specific names}:
1102 @multitable @columnfractions .20 .20 .20 .40
1103 @item Name @tab Argument @tab Return type @tab Standard
1104 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1107 @item @emph{See also}:
1108 Inverse function: @ref{SIN}
1114 @section @code{ASINH} --- Hyperbolic arcsine function
1115 @findex @code{ASINH} intrinsic
1116 @cindex hyperbolic arcsine
1117 @cindex hyperbolic sine (inverse)
1120 @item @emph{Description}:
1121 @code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1123 @item @emph{Standard}:
1129 @item @emph{Syntax}:
1132 @item @emph{Arguments}:
1133 @multitable @columnfractions .15 .80
1134 @item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1137 @item @emph{Return value}:
1138 The return value is of type @code{REAL(*)} and it lies in the
1139 range @math{-\infty \leq \asinh (x) \leq \infty}.
1141 @item @emph{Example}:
1144 REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1145 WRITE (*,*) ASINH(x)
1149 @item @emph{See also}:
1150 Inverse function: @ref{SINH}
1156 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
1157 @findex @code{ASSOCIATED} intrinsic
1158 @cindex pointer status
1161 @item @emph{Description}:
1162 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1163 or if @var{PTR} is associated with the target @var{TGT}.
1165 @item @emph{Standard}:
1171 @item @emph{Syntax}:
1172 @code{L = ASSOCIATED(PTR)}
1173 @code{L = ASSOCIATED(PTR [, TGT])}
1175 @item @emph{Arguments}:
1176 @multitable @columnfractions .15 .80
1177 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1178 it can be of any type.
1179 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1180 a @code{TARGET}. It must have the same type, kind type parameter, and
1181 array rank as @var{PTR}.
1183 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1185 @item @emph{Return value}:
1186 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1187 There are several cases:
1189 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1190 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1191 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1193 is not a 0 sized storage sequence and the target associated with @var{PTR}
1194 occupies the same storage units. If @var{PTR} is disassociated, then the
1196 @item (C) If @var{TGT} is present and an array target, the result is true if
1197 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1198 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1199 @var{PTR} occupy the same storage units in array element order.
1200 As in case(B), the result is false, if @var{PTR} is disassociated.
1201 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1202 target associated with @var{PTR} and the target associated with @var{TGT}
1203 are not 0 sized storage sequences and occupy the same storage units.
1204 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1205 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1206 target associated with @var{PTR} and the target associated with @var{TGT}
1207 have the same shape, are not 0 sized arrays, are arrays whose elements are
1208 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1209 storage units in array element order.
1210 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1213 @item @emph{Example}:
1215 program test_associated
1217 real, target :: tgt(2) = (/1., 2./)
1218 real, pointer :: ptr(:)
1220 if (associated(ptr) .eqv. .false.) call abort
1221 if (associated(ptr,tgt) .eqv. .false.) call abort
1222 end program test_associated
1225 @item @emph{See also}:
1232 @section @code{ATAN} --- Arctangent function
1233 @findex @code{ATAN} intrinsic
1234 @findex @code{DATAN} intrinsic
1235 @cindex trigonometric functions (inverse)
1238 @item @emph{Description}:
1239 @code{ATAN(X)} computes the arctangent of @var{X}.
1241 @item @emph{Standard}:
1247 @item @emph{Syntax}:
1250 @item @emph{Arguments}:
1251 @multitable @columnfractions .15 .80
1252 @item @var{X} @tab The type shall be @code{REAL(*)}.
1255 @item @emph{Return value}:
1256 The return value is of type @code{REAL(*)} and it lies in the
1257 range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
1259 @item @emph{Example}:
1262 real(8) :: x = 2.866_8
1264 end program test_atan
1267 @item @emph{Specific names}:
1268 @multitable @columnfractions .20 .20 .20 .40
1269 @item Name @tab Argument @tab Return type @tab Standard
1270 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1273 @item @emph{See also}:
1274 Inverse function: @ref{TAN}
1281 @section @code{ATAN2} --- Arctangent function
1282 @findex @code{ATAN2} intrinsic
1283 @findex @code{DATAN2} intrinsic
1284 @cindex trigonometric functions (inverse)
1287 @item @emph{Description}:
1288 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1290 @item @emph{Standard}:
1296 @item @emph{Syntax}:
1297 @code{X = ATAN2(Y,X)}
1299 @item @emph{Arguments}:
1300 @multitable @columnfractions .15 .80
1301 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1302 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1303 If @var{Y} is zero, then @var{X} must be nonzero.
1306 @item @emph{Return value}:
1307 The return value has the same type and kind type parameter as @var{Y}.
1308 It is the principal value of the complex number @math{X + i Y}. If
1309 @var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
1310 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
1311 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1312 is negative. Finally, if @var{X} is zero, then the magnitude of the result
1315 @item @emph{Example}:
1318 real(4) :: x = 1.e0_4, y = 0.5e0_4
1320 end program test_atan2
1323 @item @emph{Specific names}:
1324 @multitable @columnfractions .20 .20 .20 .40
1325 @item Name @tab Argument @tab Return type @tab Standard
1326 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1333 @section @code{ATANH} --- Hyperbolic arctangent function
1334 @findex @code{ASINH} intrinsic
1335 @cindex hyperbolic arctangent
1336 @cindex hyperbolic tangent (inverse)
1339 @item @emph{Description}:
1340 @code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1342 @item @emph{Standard}:
1348 @item @emph{Syntax}:
1351 @item @emph{Arguments}:
1352 @multitable @columnfractions .15 .80
1353 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is less than or equal to one.
1356 @item @emph{Return value}:
1357 The return value is of type @code{REAL(*)} and it lies in the
1358 range @math{-\infty \leq \atanh(x) \leq \infty}.
1360 @item @emph{Example}:
1363 REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1364 WRITE (*,*) ATANH(x)
1368 @item @emph{See also}:
1369 Inverse function: @ref{TANH}
1376 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1377 @findex @code{BESJ0} intrinsic
1378 @findex @code{DBESJ0} intrinsic
1382 @item @emph{Description}:
1383 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1386 @item @emph{Standard}:
1392 @item @emph{Syntax}:
1395 @item @emph{Arguments}:
1396 @multitable @columnfractions .15 .80
1397 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1400 @item @emph{Return value}:
1401 The return value is of type @code{REAL(*)} and it lies in the
1402 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1404 @item @emph{Example}:
1407 real(8) :: x = 0.0_8
1409 end program test_besj0
1412 @item @emph{Specific names}:
1413 @multitable @columnfractions .20 .20 .20 .40
1414 @item Name @tab Argument @tab Return type @tab Standard
1415 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1422 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1423 @findex @code{BESJ1} intrinsic
1424 @findex @code{DBESJ1} intrinsic
1428 @item @emph{Description}:
1429 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1432 @item @emph{Standard}:
1438 @item @emph{Syntax}:
1441 @item @emph{Arguments}:
1442 @multitable @columnfractions .15 .80
1443 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1446 @item @emph{Return value}:
1447 The return value is of type @code{REAL(*)} and it lies in the
1448 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1450 @item @emph{Example}:
1453 real(8) :: x = 1.0_8
1455 end program test_besj1
1458 @item @emph{Specific names}:
1459 @multitable @columnfractions .20 .20 .20 .40
1460 @item Name @tab Argument @tab Return type @tab Standard
1461 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1468 @section @code{BESJN} --- Bessel function of the first kind
1469 @findex @code{BESJN} intrinsic
1470 @findex @code{DBESJN} intrinsic
1474 @item @emph{Description}:
1475 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1478 @item @emph{Standard}:
1484 @item @emph{Syntax}:
1485 @code{Y = BESJN(N, X)}
1487 @item @emph{Arguments}:
1488 @multitable @columnfractions .15 .80
1489 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1490 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1493 @item @emph{Return value}:
1494 The return value is a scalar of type @code{REAL(*)}.
1496 @item @emph{Example}:
1499 real(8) :: x = 1.0_8
1501 end program test_besjn
1504 @item @emph{Specific names}:
1505 @multitable @columnfractions .20 .20 .20 .40
1506 @item Name @tab Argument @tab Return type @tab Standard
1507 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1508 @item @tab @code{REAL(8) X} @tab @tab
1515 @section @code{BESY0} --- Bessel function of the second kind of order 0
1516 @findex @code{BESY0} intrinsic
1517 @findex @code{DBESY0} intrinsic
1521 @item @emph{Description}:
1522 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1525 @item @emph{Standard}:
1531 @item @emph{Syntax}:
1534 @item @emph{Arguments}:
1535 @multitable @columnfractions .15 .80
1536 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1539 @item @emph{Return value}:
1540 The return value is a scalar of type @code{REAL(*)}.
1542 @item @emph{Example}:
1545 real(8) :: x = 0.0_8
1547 end program test_besy0
1550 @item @emph{Specific names}:
1551 @multitable @columnfractions .20 .20 .20 .40
1552 @item Name @tab Argument @tab Return type @tab Standard
1553 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1560 @section @code{BESY1} --- Bessel function of the second kind of order 1
1561 @findex @code{BESY1} intrinsic
1562 @findex @code{DBESY1} intrinsic
1566 @item @emph{Description}:
1567 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1570 @item @emph{Standard}:
1576 @item @emph{Syntax}:
1579 @item @emph{Arguments}:
1580 @multitable @columnfractions .15 .80
1581 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1584 @item @emph{Return value}:
1585 The return value is a scalar of type @code{REAL(*)}.
1587 @item @emph{Example}:
1590 real(8) :: x = 1.0_8
1592 end program test_besy1
1595 @item @emph{Specific names}:
1596 @multitable @columnfractions .20 .20 .20 .40
1597 @item Name @tab Argument @tab Return type @tab Standard
1598 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1605 @section @code{BESYN} --- Bessel function of the second kind
1606 @findex @code{BESYN} intrinsic
1607 @findex @code{DBESYN} intrinsic
1611 @item @emph{Description}:
1612 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1615 @item @emph{Standard}:
1621 @item @emph{Syntax}:
1622 @code{Y = BESYN(N, X)}
1624 @item @emph{Arguments}:
1625 @multitable @columnfractions .15 .80
1626 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1627 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1630 @item @emph{Return value}:
1631 The return value is a scalar of type @code{REAL(*)}.
1633 @item @emph{Example}:
1636 real(8) :: x = 1.0_8
1638 end program test_besyn
1641 @item @emph{Specific names}:
1642 @multitable @columnfractions .20 .20 .20 .40
1643 @item Name @tab Argument @tab Return type @tab Standard
1644 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1645 @item @tab @code{REAL(8) X} @tab @tab
1652 @section @code{BIT_SIZE} --- Bit size inquiry function
1653 @findex @code{BIT_SIZE} intrinsic
1657 @item @emph{Description}:
1658 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1659 represented by the type of @var{I}.
1661 @item @emph{Standard}:
1667 @item @emph{Syntax}:
1668 @code{I = BIT_SIZE(I)}
1670 @item @emph{Arguments}:
1671 @multitable @columnfractions .15 .80
1672 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1675 @item @emph{Return value}:
1676 The return value is of type @code{INTEGER(*)}
1678 @item @emph{Example}:
1680 program test_bit_size
1685 end program test_bit_size
1692 @section @code{BTEST} --- Bit test function
1693 @findex @code{BTEST} intrinsic
1697 @item @emph{Description}:
1698 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1701 @item @emph{Standard}:
1707 @item @emph{Syntax}:
1708 @code{I = BTEST(I,POS)}
1710 @item @emph{Arguments}:
1711 @multitable @columnfractions .15 .80
1712 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1713 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1716 @item @emph{Return value}:
1717 The return value is of type @code{LOGICAL}
1719 @item @emph{Example}:
1722 integer :: i = 32768 + 1024 + 64
1726 bool = btest(i, pos)
1729 end program test_btest
1736 @section @code{CEILING} --- Integer ceiling function
1737 @findex @code{CEILING} intrinsic
1741 @item @emph{Description}:
1742 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1744 @item @emph{Standard}:
1750 @item @emph{Syntax}:
1751 @code{I = CEILING(X[,KIND])}
1753 @item @emph{Arguments}:
1754 @multitable @columnfractions .15 .80
1755 @item @var{X} @tab The type shall be @code{REAL(*)}.
1756 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1759 @item @emph{Return value}:
1760 The return value is of type @code{INTEGER(KIND)}
1762 @item @emph{Example}:
1764 program test_ceiling
1767 print *, ceiling(x) ! returns 64
1768 print *, ceiling(y) ! returns -63
1769 end program test_ceiling
1772 @item @emph{See also}:
1773 @ref{FLOOR}, @ref{NINT}
1780 @section @code{CHAR} --- Character conversion function
1781 @findex @code{CHAR} intrinsic
1782 @cindex conversion function (character)
1785 @item @emph{Description}:
1786 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1788 @item @emph{Standard}:
1794 @item @emph{Syntax}:
1795 @code{C = CHAR(I[,KIND])}
1797 @item @emph{Arguments}:
1798 @multitable @columnfractions .15 .80
1799 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1800 @item @var{KIND} @tab Optional scaler integer initialization expression.
1803 @item @emph{Return value}:
1804 The return value is of type @code{CHARACTER(1)}
1806 @item @emph{Example}:
1812 print *, i, c ! returns 'J'
1813 end program test_char
1816 @item @emph{See also}:
1817 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1823 @section @code{CHDIR} --- Change working directory
1824 @findex @code{CHDIR} intrinsic
1825 @cindex file system functions
1828 @item @emph{Description}:
1829 Change current working directory to a specified @var{PATH}.
1831 @item @emph{Standard}:
1835 Non-elemental subroutine
1837 @item @emph{Syntax}:
1838 @code{CALL chdir(PATH[,STATUS])}
1840 @item @emph{Arguments}:
1841 @multitable @columnfractions .15 .80
1842 @item @var{PATH} @tab The type shall be @code{CHARACTER(*)} and shall specify a valid path within the file system.
1843 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
1844 a system specific and non-zero error code otherwise.
1847 @item @emph{Example}:
1850 CHARACTER(len=255) :: path
1852 WRITE(*,*) TRIM(path)
1855 WRITE(*,*) TRIM(path)
1859 @item @emph{See also}:
1866 @section @code{CHMOD} --- Change access permissions of files
1867 @findex @code{CHMOD}
1868 @cindex file system functions
1870 Not yet implemented in GNU Fortran.
1873 @item @emph{Description}:
1875 @item @emph{Standard}:
1881 @item @emph{Syntax}:
1882 @item @emph{Arguments}:
1883 @item @emph{Return value}:
1884 @item @emph{Example}:
1885 @item @emph{Specific names}:
1886 @item @emph{See also}:
1887 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
1893 @section @code{CMPLX} --- Complex conversion function
1894 @findex @code{CMPLX} intrinsic
1898 @item @emph{Description}:
1899 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1900 the real component. If @var{Y} is present it is converted to the imaginary
1901 component. If @var{Y} is not present then the imaginary component is set to
1902 0.0. If @var{X} is complex then @var{Y} must not be present.
1904 @item @emph{Standard}:
1910 @item @emph{Syntax}:
1911 @code{C = CMPLX(X[,Y[,KIND]])}
1913 @item @emph{Arguments}:
1914 @multitable @columnfractions .15 .80
1915 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1916 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1917 @item @var{KIND} @tab Optional scaler integer initialization expression.
1920 @item @emph{Return value}:
1921 The return value is of type @code{COMPLEX(*)}
1923 @item @emph{Example}:
1930 print *, z, cmplx(x)
1931 end program test_cmplx
1937 @node COMMAND_ARGUMENT_COUNT
1938 @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function
1939 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1940 @cindex command argument count
1943 @item @emph{Description}:
1944 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1945 command line when the containing program was invoked.
1947 @item @emph{Standard}:
1953 @item @emph{Syntax}:
1954 @code{I = COMMAND_ARGUMENT_COUNT()}
1956 @item @emph{Arguments}:
1957 @multitable @columnfractions .15 .80
1961 @item @emph{Return value}:
1962 The return value is of type @code{INTEGER(4)}
1964 @item @emph{Example}:
1966 program test_command_argument_count
1968 count = command_argument_count()
1970 end program test_command_argument_count
1977 @section @code{CONJG} --- Complex conjugate function
1978 @findex @code{CONJG} intrinsic
1979 @findex @code{DCONJG} intrinsic
1980 @cindex complex conjugate
1982 @item @emph{Description}:
1983 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
1984 then the result is @code{(x, -y)}
1986 @item @emph{Standard}:
1987 F77 and later, has overloads that are GNU extensions
1992 @item @emph{Syntax}:
1995 @item @emph{Arguments}:
1996 @multitable @columnfractions .15 .80
1997 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2000 @item @emph{Return value}:
2001 The return value is of type @code{COMPLEX(*)}.
2003 @item @emph{Example}:
2006 complex :: z = (2.0, 3.0)
2007 complex(8) :: dz = (2.71_8, -3.14_8)
2012 end program test_conjg
2015 @item @emph{Specific names}:
2016 @multitable @columnfractions .20 .20 .20 .40
2017 @item Name @tab Argument @tab Return type @tab Standard
2018 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
2025 @section @code{COS} --- Cosine function
2026 @findex @code{COS} intrinsic
2027 @findex @code{DCOS} intrinsic
2028 @findex @code{ZCOS} intrinsic
2029 @findex @code{CDCOS} intrinsic
2030 @cindex trigonometric functions
2033 @item @emph{Description}:
2034 @code{COS(X)} computes the cosine of @var{X}.
2036 @item @emph{Standard}:
2037 F77 and later, has overloads that are GNU extensions
2042 @item @emph{Syntax}:
2045 @item @emph{Arguments}:
2046 @multitable @columnfractions .15 .80
2047 @item @var{X} @tab The type shall be @code{REAL(*)} or
2051 @item @emph{Return value}:
2052 The return value is of type @code{REAL(*)} and it lies in the
2053 range @math{ -1 \leq \cos (x) \leq 1}. The kind type
2054 parameter is the same as @var{X}.
2056 @item @emph{Example}:
2061 end program test_cos
2064 @item @emph{Specific names}:
2065 @multitable @columnfractions .20 .20 .20 .40
2066 @item Name @tab Argument @tab Return type @tab Standard
2067 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2068 @item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2069 @item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2070 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2073 @item @emph{See also}:
2074 Inverse function: @ref{ACOS}
2081 @section @code{COSH} --- Hyperbolic cosine function
2082 @findex @code{COSH} intrinsic
2083 @findex @code{DCOSH} intrinsic
2084 @cindex hyperbolic cosine
2087 @item @emph{Description}:
2088 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2090 @item @emph{Standard}:
2096 @item @emph{Syntax}:
2099 @item @emph{Arguments}:
2100 @multitable @columnfractions .15 .80
2101 @item @var{X} @tab The type shall be @code{REAL(*)}.
2104 @item @emph{Return value}:
2105 The return value is of type @code{REAL(*)} and it is positive
2106 (@math{ \cosh (x) \geq 0 }.
2108 @item @emph{Example}:
2111 real(8) :: x = 1.0_8
2113 end program test_cosh
2116 @item @emph{Specific names}:
2117 @multitable @columnfractions .20 .20 .20 .40
2118 @item Name @tab Argument @tab Return type @tab Standard
2119 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2122 @item @emph{See also}:
2123 Inverse function: @ref{ACOSH}
2130 @section @code{COUNT} --- Count function
2131 @findex @code{COUNT} intrinsic
2135 @item @emph{Description}:
2136 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2137 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2138 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2139 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2141 @item @emph{Standard}:
2145 transformational function
2147 @item @emph{Syntax}:
2148 @code{I = COUNT(MASK[,DIM])}
2150 @item @emph{Arguments}:
2151 @multitable @columnfractions .15 .80
2152 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2153 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2156 @item @emph{Return value}:
2157 The return value is of type @code{INTEGER} with rank equal to that of
2160 @item @emph{Example}:
2163 integer, dimension(2,3) :: a, b
2164 logical, dimension(2,3) :: mask
2165 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2166 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2167 print '(3i3)', a(1,:)
2168 print '(3i3)', a(2,:)
2170 print '(3i3)', b(1,:)
2171 print '(3i3)', b(2,:)
2174 print '(3l3)', mask(1,:)
2175 print '(3l3)', mask(2,:)
2177 print '(3i3)', count(mask)
2179 print '(3i3)', count(mask, 1)
2181 print '(3i3)', count(mask, 2)
2182 end program test_count
2189 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2190 @findex @code{CPU_TIME} intrinsic
2194 @item @emph{Description}:
2195 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
2196 is useful for testing segments of code to determine execution time.
2198 @item @emph{Standard}:
2204 @item @emph{Syntax}:
2207 @item @emph{Arguments}:
2208 @multitable @columnfractions .15 .80
2209 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2212 @item @emph{Return value}:
2215 @item @emph{Example}:
2217 program test_cpu_time
2218 real :: start, finish
2219 call cpu_time(start)
2220 ! put code to test here
2221 call cpu_time(finish)
2222 print '("Time = ",f6.3," seconds.")',finish-start
2223 end program test_cpu_time
2230 @section @code{CSHIFT} --- Circular shift function
2231 @findex @code{CSHIFT} intrinsic
2232 @cindex bit manipulation
2235 @item @emph{Description}:
2236 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2237 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2238 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2239 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2240 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2241 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
2242 sections of @var{ARRAY} along the given dimension are shifted. Elements
2243 shifted out one end of each rank one section are shifted back in the other end.
2245 @item @emph{Standard}:
2249 transformational function
2251 @item @emph{Syntax}:
2252 @code{A = CSHIFT(A, SHIFT[,DIM])}
2254 @item @emph{Arguments}:
2255 @multitable @columnfractions .15 .80
2256 @item @var{ARRAY} @tab May be any type, not scaler.
2257 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2258 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2261 @item @emph{Return value}:
2262 Returns an array of same type and rank as the @var{ARRAY} argument.
2264 @item @emph{Example}:
2267 integer, dimension(3,3) :: a
2268 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2269 print '(3i3)', a(1,:)
2270 print '(3i3)', a(2,:)
2271 print '(3i3)', a(3,:)
2272 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2274 print '(3i3)', a(1,:)
2275 print '(3i3)', a(2,:)
2276 print '(3i3)', a(3,:)
2277 end program test_cshift
2283 @section @code{CTIME} --- Convert a time into a string
2284 @findex @code{CTIME} intrinsic
2285 @cindex ctime subroutine
2288 @item @emph{Description}:
2289 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2290 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2291 1995}, and returns that string into @var{S}.
2293 If @code{CTIME} is invoked as a function, it can not be invoked as a
2294 subroutine, and vice versa.
2296 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2297 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2299 @item @emph{Standard}:
2305 @item @emph{Syntax}:
2306 @multitable @columnfractions .80
2307 @item @code{CALL CTIME(T,S)}.
2308 @item @code{S = CTIME(T)}, (not recommended).
2311 @item @emph{Arguments}:
2312 @multitable @columnfractions .15 .80
2313 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2314 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2317 @item @emph{Return value}:
2318 The converted date and time as a string.
2320 @item @emph{Example}:
2324 character(len=30) :: date
2327 ! Do something, main part of the program
2330 print *, 'Program was started on ', date
2331 end program test_ctime
2336 @section @code{DATE_AND_TIME} --- Date and time subroutine
2337 @findex @code{DATE_AND_TIME} intrinsic
2338 @cindex DATE_AND_TIME
2341 @item @emph{Description}:
2342 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2343 time information from the real-time system clock. @var{DATE} is
2344 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
2345 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2346 representing the difference with respect to Coordinated Universal Time (UTC).
2347 Unavailable time and date parameters return blanks.
2349 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2351 @multitable @columnfractions .15 .30 .60
2352 @item @tab @code{VALUE(1)}: @tab The year
2353 @item @tab @code{VALUE(2)}: @tab The month
2354 @item @tab @code{VALUE(3)}: @tab The day of the month
2355 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2356 @item @tab @code{VALUE(5)}: @tab The hour of the day
2357 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2358 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2359 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2362 @item @emph{Standard}:
2368 @item @emph{Syntax}:
2369 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2371 @item @emph{Arguments}:
2372 @multitable @columnfractions .15 .80
2373 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2374 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2375 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2376 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2379 @item @emph{Return value}:
2382 @item @emph{Example}:
2384 program test_time_and_date
2385 character(8) :: date
2386 character(10) :: time
2387 character(5) :: zone
2388 integer,dimension(8) :: values
2389 ! using keyword arguments
2390 call date_and_time(date,time,zone,values)
2391 call date_and_time(DATE=date,ZONE=zone)
2392 call date_and_time(TIME=time)
2393 call date_and_time(VALUES=values)
2394 print '(a,2x,a,2x,a)', date, time, zone
2395 print '(8i5))', values
2396 end program test_time_and_date
2403 @section @code{DBLE} --- Double conversion function
2404 @findex @code{DBLE} intrinsic
2405 @cindex double conversion
2408 @item @emph{Description}:
2409 @code{DBLE(X)} Converts @var{X} to double precision real type.
2411 @item @emph{Standard}:
2417 @item @emph{Syntax}:
2420 @item @emph{Arguments}:
2421 @multitable @columnfractions .15 .80
2422 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2425 @item @emph{Return value}:
2426 The return value is of type double precision real.
2428 @item @emph{Example}:
2433 complex :: z = (2.3,1.14)
2434 print *, dble(x), dble(i), dble(z)
2435 end program test_dble
2438 @item @emph{See also}:
2439 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2445 @section @code{DCMPLX} --- Double complex conversion function
2446 @findex @code{DCMPLX} intrinsic
2450 @item @emph{Description}:
2451 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2452 converted to the real component. If @var{Y} is present it is converted to the
2453 imaginary component. If @var{Y} is not present then the imaginary component is
2454 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
2456 @item @emph{Standard}:
2462 @item @emph{Syntax}:
2463 @code{C = DCMPLX(X)}
2464 @code{C = DCMPLX(X,Y)}
2466 @item @emph{Arguments}:
2467 @multitable @columnfractions .15 .80
2468 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2469 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
2472 @item @emph{Return value}:
2473 The return value is of type @code{COMPLEX(8)}
2475 @item @emph{Example}:
2485 print *, dcmplx(x,i)
2486 end program test_dcmplx
2493 @section @code{DFLOAT} --- Double conversion function
2494 @findex @code{DFLOAT} intrinsic
2495 @cindex double float conversion
2498 @item @emph{Description}:
2499 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2501 @item @emph{Standard}:
2507 @item @emph{Syntax}:
2508 @code{X = DFLOAT(X)}
2510 @item @emph{Arguments}:
2511 @multitable @columnfractions .15 .80
2512 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2515 @item @emph{Return value}:
2516 The return value is of type double precision real.
2518 @item @emph{Example}:
2523 end program test_dfloat
2526 @item @emph{See also}:
2527 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2533 @section @code{DIGITS} --- Significant digits function
2534 @findex @code{DIGITS} intrinsic
2535 @cindex digits, significant
2538 @item @emph{Description}:
2539 @code{DIGITS(X)} returns the number of significant digits of the internal model
2540 representation of @var{X}. For example, on a system using a 32-bit
2541 floating point representation, a default real number would likely return 24.
2543 @item @emph{Standard}:
2549 @item @emph{Syntax}:
2550 @code{C = DIGITS(X)}
2552 @item @emph{Arguments}:
2553 @multitable @columnfractions .15 .80
2554 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2557 @item @emph{Return value}:
2558 The return value is of type @code{INTEGER}.
2560 @item @emph{Example}:
2563 integer :: i = 12345
2569 end program test_digits
2576 @section @code{DIM} --- Dim function
2577 @findex @code{DIM} intrinsic
2578 @findex @code{IDIM} intrinsic
2579 @findex @code{DDIM} intrinsic
2583 @item @emph{Description}:
2584 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2585 otherwise returns zero.
2587 @item @emph{Standard}:
2593 @item @emph{Syntax}:
2596 @item @emph{Arguments}:
2597 @multitable @columnfractions .15 .80
2598 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2599 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2602 @item @emph{Return value}:
2603 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2605 @item @emph{Example}:
2611 x = dim(4.345_8, 2.111_8)
2614 end program test_dim
2617 @item @emph{Specific names}:
2618 @multitable @columnfractions .20 .20 .20 .40
2619 @item Name @tab Argument @tab Return type @tab Standard
2620 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2621 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab F77 and later
2628 @section @code{DOT_PRODUCT} --- Dot product function
2629 @findex @code{DOT_PRODUCT} intrinsic
2633 @item @emph{Description}:
2634 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2635 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2636 and must be arrays of rank one and of equal size. If the vectors are
2637 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2638 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2639 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2641 @item @emph{Standard}:
2645 transformational function
2647 @item @emph{Syntax}:
2648 @code{S = DOT_PRODUCT(X,Y)}
2650 @item @emph{Arguments}:
2651 @multitable @columnfractions .15 .80
2652 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2653 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2656 @item @emph{Return value}:
2657 If the arguments are numeric, the return value is a scaler of numeric type,
2658 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2659 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2661 @item @emph{Example}:
2663 program test_dot_prod
2664 integer, dimension(3) :: a, b
2671 print *, dot_product(a,b)
2672 end program test_dot_prod
2679 @section @code{DPROD} --- Double product function
2680 @findex @code{DPROD} intrinsic
2681 @cindex Double product
2684 @item @emph{Description}:
2685 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2687 @item @emph{Standard}:
2693 @item @emph{Syntax}:
2694 @code{D = DPROD(X,Y)}
2696 @item @emph{Arguments}:
2697 @multitable @columnfractions .15 .80
2698 @item @var{X} @tab The type shall be @code{REAL}.
2699 @item @var{Y} @tab The type shall be @code{REAL}.
2702 @item @emph{Return value}:
2703 The return value is of type @code{REAL(8)}.
2705 @item @emph{Example}:
2714 end program test_dprod
2721 @section @code{DREAL} --- Double real part function
2722 @findex @code{DREAL} intrinsic
2723 @cindex Double real part
2726 @item @emph{Description}:
2727 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2729 @item @emph{Standard}:
2735 @item @emph{Syntax}:
2738 @item @emph{Arguments}:
2739 @multitable @columnfractions .15 .80
2740 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2743 @item @emph{Return value}:
2744 The return value is of type @code{REAL(8)}.
2746 @item @emph{Example}:
2749 complex(8) :: z = (1.3_8,7.2_8)
2751 end program test_dreal
2754 @item @emph{See also}:
2762 @section @code{DTIME} --- Execution time subroutine (or function)
2763 @findex @code{DTIME} intrinsic
2764 @cindex dtime subroutine
2767 @item @emph{Description}:
2768 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2769 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2770 returns the user and system components of this time in @code{TARRAY(1)} and
2771 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2774 Subsequent invocations of @code{DTIME} return values accumulated since the
2775 previous invocation.
2777 On some systems, the underlying timings are represented using types with
2778 sufficiently small limits that overflows (wrap around) are possible, such as
2779 32-bit types. Therefore, the values returned by this intrinsic might be, or
2780 become, negative, or numerically less than previous values, during a single
2781 run of the compiled program.
2783 If @code{DTIME} is invoked as a function, it can not be invoked as a
2784 subroutine, and vice versa.
2786 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2788 @multitable @columnfractions .15 .30 .60
2789 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2790 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2791 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2794 @item @emph{Standard}:
2800 @item @emph{Syntax}:
2801 @multitable @columnfractions .80
2802 @item @code{CALL DTIME(TARRAY, RESULT)}.
2803 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2806 @item @emph{Arguments}:
2807 @multitable @columnfractions .15 .80
2808 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2809 @item @var{RESULT}@tab The type shall be @code{REAL}.
2812 @item @emph{Return value}:
2813 Elapsed time in seconds since the start of program execution.
2815 @item @emph{Example}:
2819 real, dimension(2) :: tarray
2821 call dtime(tarray, result)
2825 do i=1,100000000 ! Just a delay
2828 call dtime(tarray, result)
2832 end program test_dtime
2839 @section @code{EOSHIFT} --- End-off shift function
2840 @findex @code{EOSHIFT} intrinsic
2841 @cindex bit manipulation
2844 @item @emph{Description}:
2845 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2846 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2847 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2848 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2849 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2850 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2851 then all complete rank one sections of @var{ARRAY} along the given dimension are
2852 shifted. Elements shifted out one end of each rank one section are dropped. If
2853 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2854 is copied back in the other end. If @var{BOUNDARY} is not present then the
2855 following are copied in depending on the type of @var{ARRAY}.
2857 @multitable @columnfractions .15 .80
2858 @item @emph{Array Type} @tab @emph{Boundary Value}
2859 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2860 @item Logical @tab @code{.FALSE.}.
2861 @item Character(@var{len}) @tab @var{len} blanks.
2864 @item @emph{Standard}:
2868 transformational function
2870 @item @emph{Syntax}:
2871 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2873 @item @emph{Arguments}:
2874 @multitable @columnfractions .15 .80
2875 @item @var{ARRAY} @tab May be any type, not scaler.
2876 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2877 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2878 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2881 @item @emph{Return value}:
2882 Returns an array of same type and rank as the @var{ARRAY} argument.
2884 @item @emph{Example}:
2886 program test_eoshift
2887 integer, dimension(3,3) :: a
2888 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2889 print '(3i3)', a(1,:)
2890 print '(3i3)', a(2,:)
2891 print '(3i3)', a(3,:)
2892 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2894 print '(3i3)', a(1,:)
2895 print '(3i3)', a(2,:)
2896 print '(3i3)', a(3,:)
2897 end program test_eoshift
2904 @section @code{EPSILON} --- Epsilon function
2905 @findex @code{EPSILON} intrinsic
2906 @cindex epsilon, significant
2909 @item @emph{Description}:
2910 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2912 @item @emph{Standard}:
2918 @item @emph{Syntax}:
2919 @code{C = EPSILON(X)}
2921 @item @emph{Arguments}:
2922 @multitable @columnfractions .15 .80
2923 @item @var{X} @tab The type shall be @code{REAL(*)}.
2926 @item @emph{Return value}:
2927 The return value is of same type as the argument.
2929 @item @emph{Example}:
2931 program test_epsilon
2936 end program test_epsilon
2943 @section @code{ERF} --- Error function
2944 @findex @code{ERF} intrinsic
2945 @cindex error function
2948 @item @emph{Description}:
2949 @code{ERF(X)} computes the error function of @var{X}.
2951 @item @emph{Standard}:
2957 @item @emph{Syntax}:
2960 @item @emph{Arguments}:
2961 @multitable @columnfractions .15 .80
2962 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2965 @item @emph{Return value}:
2966 The return value is a scalar of type @code{REAL(*)} and it is positive
2967 (@math{ - 1 \leq erf (x) \leq 1 }.
2969 @item @emph{Example}:
2972 real(8) :: x = 0.17_8
2974 end program test_erf
2977 @item @emph{Specific names}:
2978 @multitable @columnfractions .20 .20 .20 .40
2979 @item Name @tab Argument @tab Return type @tab Standard
2980 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
2987 @section @code{ERFC} --- Error function
2988 @findex @code{ERFC} intrinsic
2989 @cindex error function
2992 @item @emph{Description}:
2993 @code{ERFC(X)} computes the complementary error function of @var{X}.
2995 @item @emph{Standard}:
3001 @item @emph{Syntax}:
3004 @item @emph{Arguments}:
3005 @multitable @columnfractions .15 .80
3006 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3009 @item @emph{Return value}:
3010 The return value is a scalar of type @code{REAL(*)} and it is positive
3011 (@math{ 0 \leq erfc (x) \leq 2 }.
3013 @item @emph{Example}:
3016 real(8) :: x = 0.17_8
3018 end program test_erfc
3021 @item @emph{Specific names}:
3022 @multitable @columnfractions .20 .20 .20 .40
3023 @item Name @tab Argument @tab Return type @tab Standard
3024 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
3031 @section @code{ETIME} --- Execution time subroutine (or function)
3032 @findex @code{ETIME} intrinsic
3033 @cindex time functions
3036 @item @emph{Description}:
3037 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3038 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
3039 returns the user and system components of this time in @code{TARRAY(1)} and
3040 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3042 On some systems, the underlying timings are represented using types with
3043 sufficiently small limits that overflows (wrap around) are possible, such as
3044 32-bit types. Therefore, the values returned by this intrinsic might be, or
3045 become, negative, or numerically less than previous values, during a single
3046 run of the compiled program.
3048 If @code{ETIME} is invoked as a function, it can not be invoked as a
3049 subroutine, and vice versa.
3051 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3053 @multitable @columnfractions .15 .30 .60
3054 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3055 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3056 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3059 @item @emph{Standard}:
3065 @item @emph{Syntax}:
3066 @multitable @columnfractions .8
3067 @item @code{CALL ETIME(TARRAY, RESULT)}.
3068 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3071 @item @emph{Arguments}:
3072 @multitable @columnfractions .15 .80
3073 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3074 @item @var{RESULT}@tab The type shall be @code{REAL}.
3077 @item @emph{Return value}:
3078 Elapsed time in seconds since the start of program execution.
3080 @item @emph{Example}:
3084 real, dimension(2) :: tarray
3086 call ETIME(tarray, result)
3090 do i=1,100000000 ! Just a delay
3093 call ETIME(tarray, result)
3097 end program test_etime
3100 @item @emph{See also}:
3108 @section @code{EXIT} --- Exit the program with status.
3113 @item @emph{Description}:
3114 @code{EXIT} causes immediate termination of the program with status. If status
3115 is omitted it returns the canonical @emph{success} for the system. All Fortran
3116 I/O units are closed.
3118 @item @emph{Standard}:
3124 @item @emph{Syntax}:
3125 @code{CALL EXIT([STATUS])}
3127 @item @emph{Arguments}:
3128 @multitable @columnfractions .15 .80
3129 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3132 @item @emph{Return value}:
3133 @code{STATUS} is passed to the parent process on exit.
3135 @item @emph{Example}:
3138 integer :: STATUS = 0
3139 print *, 'This program is going to exit.'
3141 end program test_exit
3144 @item @emph{See also}:
3145 @ref{ABORT}, @ref{KILL}
3151 @section @code{EXP} --- Exponential function
3152 @findex @code{EXP} intrinsic
3153 @findex @code{DEXP} intrinsic
3154 @findex @code{ZEXP} intrinsic
3155 @findex @code{CDEXP} intrinsic
3159 @item @emph{Description}:
3160 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3162 @item @emph{Standard}:
3163 F77 and later, has overloads that are GNU extensions
3168 @item @emph{Syntax}:
3171 @item @emph{Arguments}:
3172 @multitable @columnfractions .15 .80
3173 @item @var{X} @tab The type shall be @code{REAL(*)} or
3177 @item @emph{Return value}:
3178 The return value has same type and kind as @var{X}.
3180 @item @emph{Example}:
3185 end program test_exp
3188 @item @emph{Specific names}:
3189 @multitable @columnfractions .20 .20 .20 .40
3190 @item Name @tab Argument @tab Return type @tab Standard
3191 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
3192 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
3193 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3194 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3201 @section @code{EXPONENT} --- Exponent function
3202 @findex @code{EXPONENT} intrinsic
3203 @cindex exponent function
3206 @item @emph{Description}:
3207 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3208 is zero the value returned is zero.
3210 @item @emph{Standard}:
3216 @item @emph{Syntax}:
3217 @code{I = EXPONENT(X)}
3219 @item @emph{Arguments}:
3220 @multitable @columnfractions .15 .80
3221 @item @var{X} @tab The type shall be @code{REAL(*)}.
3224 @item @emph{Return value}:
3225 The return value is of type default @code{INTEGER}.
3227 @item @emph{Example}:
3229 program test_exponent
3234 print *, exponent(0.0)
3235 end program test_exponent
3241 @section @code{FDATE} --- Get the current time as a string
3242 @findex @code{FDATE} intrinsic
3243 @cindex fdate subroutine
3246 @item @emph{Description}:
3247 @code{FDATE(DATE)} returns the current date (using the same format as
3248 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3251 If @code{FDATE} is invoked as a function, it can not be invoked as a
3252 subroutine, and vice versa.
3254 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3256 @item @emph{Standard}:
3262 @item @emph{Syntax}:
3263 @multitable @columnfractions .80
3264 @item @code{CALL FDATE(DATE)}.
3265 @item @code{DATE = FDATE()}, (not recommended).
3268 @item @emph{Arguments}:
3269 @multitable @columnfractions .15 .80
3270 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3273 @item @emph{Return value}:
3274 The current date and time as a string.
3276 @item @emph{Example}:
3280 character(len=30) :: date
3282 print *, 'Program started on ', date
3283 do i = 1, 100000000 ! Just a delay
3287 print *, 'Program ended on ', date
3288 end program test_fdate
3294 @section @code{FLOAT} --- Convert integer to default real
3295 @findex @code{FLOAT} intrinsic
3296 @cindex conversion function (float)
3299 @item @emph{Description}:
3300 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3302 @item @emph{Standard}:
3308 @item @emph{Syntax}:
3311 @item @emph{Arguments}:
3312 @multitable @columnfractions .15 .80
3313 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3316 @item @emph{Return value}:
3317 The return value is of type default @code{REAL}
3319 @item @emph{Example}:
3323 if (float(i) /= 1.) call abort
3324 end program test_float
3327 @item @emph{See also}:
3328 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3334 @section @code{FGET} --- Read a single character in stream mode from stdin
3335 @findex @code{FGET} intrinsic
3336 @cindex file operations
3337 @cindex stream operations
3340 @item @emph{Description}:
3341 Read a single character in stream mode from stdin by bypassing normal
3342 formatted output. Stream I/O should not be mixed with normal record-oriented
3343 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3345 This intrinsic routine is provided for backwards compatibility with
3346 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3347 Programmers should consider the use of new stream IO feature in new code
3348 for future portability. See also @ref{Fortran 2003 status}.
3350 @item @emph{Standard}:
3354 Non-elemental subroutine
3356 @item @emph{Syntax}:
3357 @code{CALL fget(C[,STATUS])}
3359 @item @emph{Arguments}:
3360 @multitable @columnfractions .15 .80
3361 @item @var{C} @tab The type shall be @code{CHARACTER}.
3362 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3363 -1 on end-of-file and a system specific positive error code otherwise.
3366 @item @emph{Example}:
3369 INTEGER, PARAMETER :: strlen = 100
3370 INTEGER :: status, i = 1
3371 CHARACTER(len=strlen) :: str = ""
3373 WRITE (*,*) 'Enter text:'
3375 CALL fget(str(i:i), status)
3376 if (status /= 0 .OR. i > strlen) exit
3379 WRITE (*,*) TRIM(str)
3383 @item @emph{See also}:
3384 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3389 @section @code{FGETC} --- Read a single character in stream mode
3390 @findex @code{FGETC} intrinsic
3391 @cindex file operations
3392 @cindex stream operations
3395 @item @emph{Description}:
3396 Read a single character in stream mode by bypassing normal formatted output.
3397 Stream I/O should not be mixed with normal record-oriented (formatted or
3398 unformatted) I/O on the same unit; the results are unpredictable.
3400 This intrinsic routine is provided for backwards compatibility with
3401 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3402 Programmers should consider the use of new stream IO feature in new code
3403 for future portability. See also @ref{Fortran 2003 status}.
3405 @item @emph{Standard}:
3409 Non-elemental subroutine
3411 @item @emph{Syntax}:
3412 @code{CALL fgetc(UNIT,C[,STATUS])}
3414 @item @emph{Arguments}:
3415 @multitable @columnfractions .15 .80
3416 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3417 @item @var{C} @tab The type shall be @code{CHARACTER}.
3418 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3419 -1 on end-of-file and a system specific positive error code otherwise.
3422 @item @emph{Example}:
3425 INTEGER :: fd = 42, status
3428 OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3430 CALL fgetc(fd, c, status)
3431 IF (status /= 0) EXIT
3438 @item @emph{See also}:
3439 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3445 @section @code{FLOOR} --- Integer floor function
3446 @findex @code{FLOOR} intrinsic
3450 @item @emph{Description}:
3451 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3453 @item @emph{Standard}:
3459 @item @emph{Syntax}:
3460 @code{I = FLOOR(X[,KIND])}
3462 @item @emph{Arguments}:
3463 @multitable @columnfractions .15 .80
3464 @item @var{X} @tab The type shall be @code{REAL(*)}.
3465 @item @var{KIND} @tab Optional scaler integer initialization expression.
3468 @item @emph{Return value}:
3469 The return value is of type @code{INTEGER(KIND)}
3471 @item @emph{Example}:
3476 print *, floor(x) ! returns 63
3477 print *, floor(y) ! returns -64
3478 end program test_floor
3481 @item @emph{See also}:
3482 @ref{CEILING}, @ref{NINT}
3489 @section @code{FLUSH} --- Flush I/O unit(s)
3490 @findex @code{FLUSH}
3494 @item @emph{Description}:
3495 Flushes Fortran unit(s) currently open for output. Without the optional
3496 argument, all units are flushed, otherwise just the unit specified.
3498 @item @emph{Standard}:
3502 non-elemental subroutine
3504 @item @emph{Syntax}:
3505 @code{CALL FLUSH(UNIT)}
3507 @item @emph{Arguments}:
3508 @multitable @columnfractions .15 .80
3509 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3513 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3514 statement that should be preferred over the @code{FLUSH} intrinsic.
3521 @section @code{FNUM} --- File number function
3522 @findex @code{FNUM} intrinsic
3526 @item @emph{Description}:
3527 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3528 open Fortran I/O unit @code{UNIT}.
3530 @item @emph{Standard}:
3534 non-elemental function
3536 @item @emph{Syntax}:
3537 @code{I = FNUM(UNIT)}
3539 @item @emph{Arguments}:
3540 @multitable @columnfractions .15 .80
3541 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3544 @item @emph{Return value}:
3545 The return value is of type @code{INTEGER}
3547 @item @emph{Example}:
3551 open (unit=10, status = "scratch")
3555 end program test_fnum
3562 @section @code{FPUT} --- Write a single character in stream mode to stdout
3563 @findex @code{FPUT} intrinsic
3564 @cindex file operations
3565 @cindex stream operations
3568 @item @emph{Description}:
3569 Write a single character in stream mode to stdout by bypassing normal
3570 formatted output. Stream I/O should not be mixed with normal record-oriented
3571 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3573 This intrinsic routine is provided for backwards compatibility with
3574 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3575 Programmers should consider the use of new stream IO feature in new code
3576 for future portability. See also @ref{Fortran 2003 status}.
3578 @item @emph{Standard}:
3582 Non-elemental subroutine
3584 @item @emph{Syntax}:
3585 @code{CALL fput(C[,STATUS])}
3587 @item @emph{Arguments}:
3588 @multitable @columnfractions .15 .80
3589 @item @var{C} @tab The type shall be @code{CHARACTER}.
3590 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3591 -1 on end-of-file and a system specific positive error code otherwise.
3594 @item @emph{Example}:
3597 CHARACTER(len=*) :: str = "gfortran"
3599 DO i = 1, len_trim(str)
3605 @item @emph{See also}:
3606 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3612 @section @code{FPUTC} --- Write a single character in stream mode
3613 @findex @code{FPUTC} intrinsic
3614 @cindex file operations
3615 @cindex stream operations
3618 @item @emph{Description}:
3619 Write a single character in stream mode by bypassing normal formatted
3620 output. Stream I/O should not be mixed with normal record-oriented
3621 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3623 This intrinsic routine is provided for backwards compatibility with
3624 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3625 Programmers should consider the use of new stream IO feature in new code
3626 for future portability. See also @ref{Fortran 2003 status}.
3628 @item @emph{Standard}:
3632 Non-elemental subroutine
3634 @item @emph{Syntax}:
3635 @code{CALL fputc(UNIT,C[,STATUS])}
3637 @item @emph{Arguments}:
3638 @multitable @columnfractions .15 .80
3639 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3640 @item @var{C} @tab The type shall be @code{CHARACTER}.
3641 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3642 -1 on end-of-file and a system specific positive error code otherwise.
3645 @item @emph{Example}:
3648 CHARACTER(len=*) :: str = "gfortran"
3649 INTEGER :: fd = 42, i
3651 OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3652 DO i = 1, len_trim(str)
3653 CALL fputc(fd, str(i:i))
3659 @item @emph{See also}:
3660 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3666 @section @code{FRACTION} --- Fractional part of the model representation
3667 @findex @code{FRACTION} intrinsic
3668 @cindex fractional part
3671 @item @emph{Description}:
3672 @code{FRACTION(X)} returns the fractional part of the model
3673 representation of @code{X}.
3675 @item @emph{Standard}:
3681 @item @emph{Syntax}:
3682 @code{Y = FRACTION(X)}
3684 @item @emph{Arguments}:
3685 @multitable @columnfractions .15 .80
3686 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3689 @item @emph{Return value}:
3690 The return value is of the same type and kind as the argument.
3691 The fractional part of the model representation of @code{X} is returned;
3692 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3694 @item @emph{Example}:
3696 program test_fraction
3699 print *, fraction(x), x * radix(x)**(-exponent(x))
3700 end program test_fraction
3708 @section @code{FREE} --- Frees memory
3709 @findex @code{FREE} intrinsic
3713 @item @emph{Description}:
3714 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3715 intrinsic is an extension intended to be used with Cray pointers, and is
3716 provided in GNU Fortran to allow user to compile legacy code. For
3717 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3720 @item @emph{Standard}:
3726 @item @emph{Syntax}:
3729 @item @emph{Arguments}:
3730 @multitable @columnfractions .15 .80
3731 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3732 location of the memory that should be de-allocated.
3735 @item @emph{Return value}:
3738 @item @emph{Example}:
3739 See @code{MALLOC} for an example.
3741 @item @emph{See also}:
3749 @section @code{FSTAT} --- Get file status
3750 @findex @code{FSTAT} intrinsic
3751 @cindex undocumented intrinsic
3753 Intrinsic implemented, documentation pending.
3756 @item @emph{Description}:
3759 @item @emph{Standard}:
3761 @item @emph{Syntax}:
3762 @item @emph{Arguments}:
3763 @item @emph{Return value}:
3764 @item @emph{Example}:
3765 @item @emph{Specific names}:
3766 @item @emph{See also}:
3772 @section @code{FSEEK} --- Low level file positioning subroutine
3773 @findex @code{FSEEK}
3774 @cindex file system functions
3776 Not yet implemented in GNU Fortran.
3779 @item @emph{Description}:
3781 @item @emph{Standard}:
3787 @item @emph{Syntax}:
3788 @item @emph{Arguments}:
3789 @item @emph{Return value}:
3790 @item @emph{Example}:
3791 @item @emph{Specific names}:
3792 @item @emph{See also}:
3793 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3800 @section @code{FTELL} --- Current stream position
3801 @findex @code{FTELL} intrinsic
3802 @cindex undocumented intrinsic
3804 Intrinsic implemented, documentation pending.
3807 @item @emph{Description}:
3808 @item @emph{Standard}:
3812 @item @emph{Syntax}:
3813 @item @emph{Arguments}:
3814 @item @emph{Return value}:
3815 @item @emph{Example}:
3816 @item @emph{Specific names}:
3817 @item @emph{See also}:
3823 @section @code{GETARG} --- Get command line arguments
3824 @findex @code{GETARG} intrinsic
3825 @cindex undocumented intrinsic
3827 Intrinsic implemented, documentation pending.
3830 @item @emph{Description}:
3831 @item @emph{Standard}:
3835 @item @emph{Syntax}:
3836 @item @emph{Arguments}:
3837 @item @emph{Return value}:
3838 @item @emph{Example}:
3839 @item @emph{Specific names}:
3841 @item @emph{See also}:
3842 @ref{IARGC}, @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
3848 @section @code{GET_COMMAND} --- Subroutine to retrieve the entire command line
3849 @findex @code{GET_COMMAND} intrinsic
3850 @cindex undocumented intrinsic
3852 Intrinsic implemented, documentation pending.
3855 @item @emph{Description}:
3856 @item @emph{Standard}:
3860 @item @emph{Syntax}:
3861 @item @emph{Arguments}:
3862 @item @emph{Return value}:
3863 @item @emph{Example}:
3864 @item @emph{Specific names}:
3865 @item @emph{See also}:
3870 @node GET_COMMAND_ARGUMENT
3871 @section @code{GET_COMMAND_ARGUMENT} --- Subroutine to retrieve a command argument
3872 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
3873 @cindex undocumented intrinsic
3875 Intrinsic implemented, documentation pending.
3878 @item @emph{Description}:
3879 @item @emph{Standard}:
3883 @item @emph{Syntax}:
3884 @item @emph{Arguments}:
3885 @item @emph{Return value}:
3886 @item @emph{Example}:
3887 @item @emph{Specific names}:
3888 @item @emph{See also}:
3889 @ref{COMMAND_ARGUMENT_COUNT}
3895 @section @code{GETCWD} --- Get current working directory
3896 @findex @code{GETCWD} intrinsic
3897 @cindex file system functions
3900 @item @emph{Description}:
3901 Get current working directory.
3903 @item @emph{Standard}:
3907 Non-elemental subroutine.
3909 @item @emph{Syntax}:
3910 @code{CALL getcwd(CWD[,STATUS])}
3912 @item @emph{Arguments}:
3913 @multitable @columnfractions .15 .80
3914 @item @var{CWD} @tab The type shall be @code{CHARACTER(*)}.
3915 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
3916 a system specific and non-zero error code otherwise.
3919 @item @emph{Example}:
3922 CHARACTER(len=255) :: cwd
3924 WRITE(*,*) TRIM(cwd)
3928 @item @emph{See also}:
3935 @section @code{GETENV} --- Get an environmental variable
3936 @findex @code{GETENV} intrinsic
3937 @cindex undocumented intrinsic
3939 Intrinsic implemented, documentation pending.
3942 @item @emph{Description}:
3943 @item @emph{Standard}:
3947 @item @emph{Syntax}:
3948 @item @emph{Arguments}:
3949 @item @emph{Return value}:
3950 @item @emph{Example}:
3951 @item @emph{Specific names}:
3952 @item @emph{See also}:
3953 @ref{GET_ENVIRONMENT_VARIABLE}
3958 @node GET_ENVIRONMENT_VARIABLE
3959 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
3960 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
3961 @cindex undocumented intrinsic
3963 Intrinsic implemented, documentation pending.
3966 @item @emph{Description}:
3967 @item @emph{Standard}:
3973 @item @emph{Syntax}:
3974 @item @emph{Arguments}:
3975 @item @emph{Return value}:
3976 @item @emph{Example}:
3977 @item @emph{Specific names}:
3978 @item @emph{See also}:
3984 @section @code{GETGID} --- Group ID function
3985 @findex @code{GETGID} intrinsic
3989 @item @emph{Description}:
3990 Returns the numerical group ID of the current process.
3992 @item @emph{Standard}:
3998 @item @emph{Syntax}:
4001 @item @emph{Return value}:
4002 The return value of @code{GETGID} is an @code{INTEGER} of the default
4006 @item @emph{Example}:
4007 See @code{GETPID} for an example.
4009 @item @emph{See also}:
4016 @section @code{GETLOG} --- Get login name
4017 @findex @code{GETLOG} intrinsic
4018 @cindex undocumented intrinsic
4020 Intrinsic implemented, documentation pending.
4023 @item @emph{Description}:
4024 @item @emph{Standard}:
4030 @item @emph{Syntax}:
4031 @item @emph{Arguments}:
4032 @item @emph{Return value}:
4033 @item @emph{Example}:
4034 @item @emph{Specific names}:
4035 @item @emph{See also}:
4042 @section @code{GETPID} --- Process ID function
4043 @findex @code{GETPID} intrinsic
4047 @item @emph{Description}:
4048 Returns the numerical process identifier of the current process.
4050 @item @emph{Standard}:
4056 @item @emph{Syntax}:
4059 @item @emph{Return value}:
4060 The return value of @code{GETPID} is an @code{INTEGER} of the default
4064 @item @emph{Example}:
4067 print *, "The current process ID is ", getpid()
4068 print *, "Your numerical user ID is ", getuid()
4069 print *, "Your numerical group ID is ", getgid()
4078 @section @code{GETUID} --- User ID function
4079 @findex @code{GETUID} intrinsic
4083 @item @emph{Description}:
4084 Returns the numerical user ID of the current process.
4086 @item @emph{Standard}:
4092 @item @emph{Syntax}:
4095 @item @emph{Return value}:
4096 The return value of @code{GETUID} is an @code{INTEGER} of the default
4100 @item @emph{Example}:
4101 See @code{GETPID} for an example.
4103 @item @emph{See also}:
4110 @section @code{GMTIME} --- Convert time to GMT info
4111 @findex @code{GMTIME}
4112 @cindex time function
4114 Not yet implemented in GNU Fortran.
4117 @item @emph{Description}:
4119 @item @emph{Standard}:
4125 @item @emph{Syntax}:
4126 @item @emph{Arguments}:
4127 @item @emph{Return value}:
4128 @item @emph{Example}:
4129 @item @emph{Specific names}:
4130 @item @emph{See also}:
4131 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
4138 @section @code{HOSTNM} --- Get system host name
4139 @findex @code{HOSTNM} intrinsic
4140 @cindex undocumented intrinsic
4142 Intrinsic implemented, documentation pending.
4145 @item @emph{Description}:
4146 @item @emph{Standard}:
4150 @item @emph{Syntax}:
4151 @item @emph{Arguments}:
4152 @item @emph{Return value}:
4153 @item @emph{Example}:
4154 @item @emph{Specific names}:
4155 @item @emph{See also}:
4161 @section @code{HUGE} --- Largest number of a kind
4162 @findex @code{HUGE} intrinsic
4166 @item @emph{Description}:
4167 @code{HUGE(X)} returns the largest number that is not an infinity in
4168 the model of the type of @code{X}.
4170 @item @emph{Standard}:
4176 @item @emph{Syntax}:
4179 @item @emph{Arguments}:
4180 @multitable @columnfractions .15 .80
4181 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4184 @item @emph{Return value}:
4185 The return value is of the same type and kind as @var{X}
4187 @item @emph{Example}:
4189 program test_huge_tiny
4190 print *, huge(0), huge(0.0), huge(0.0d0)
4191 print *, tiny(0.0), tiny(0.0d0)
4192 end program test_huge_tiny
4199 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
4200 @findex @code{IACHAR} intrinsic
4201 @cindex @acronym{ASCII} collating sequence
4202 @cindex conversion function (character)
4205 @item @emph{Description}:
4206 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4207 in the first character position of @code{C}.
4209 @item @emph{Standard}:
4215 @item @emph{Syntax}:
4216 @code{I = IACHAR(C)}
4218 @item @emph{Arguments}:
4219 @multitable @columnfractions .15 .80
4220 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4223 @item @emph{Return value}:
4224 The return value is of type @code{INTEGER} and of the default integer
4227 @item @emph{Example}:
4232 end program test_iachar
4235 @item @emph{See also}:
4236 @ref{CHAR},@ref{ICHAR}
4242 @section @code{IAND} --- Bitwise logical and
4243 @findex @code{IAND} intrinsic
4244 @cindex bit operations
4246 Intrinsic implemented, documentation pending.
4249 @item @emph{Description}:
4250 @item @emph{Standard}:
4256 @item @emph{Syntax}:
4257 @item @emph{Arguments}:
4258 @item @emph{Return value}:
4259 @item @emph{Example}:
4260 @item @emph{Specific names}:
4262 @item @emph{See also}:
4263 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4270 @section @code{IARGC} --- Get number of command line arguments
4271 @findex @code{IARGC} intrinsic
4272 @cindex undocumented intrinsic
4274 Intrinsic implemented, documentation pending.
4277 @item @emph{Description}:
4278 @item @emph{Standard}:
4282 @item @emph{Syntax}:
4283 @item @emph{Arguments}:
4284 @item @emph{Return value}:
4285 @item @emph{Example}:
4286 @item @emph{Specific names}:
4287 @item @emph{See also}:
4288 @ref{GETARG}, @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}, @ref{GET_COMMAND_ARGUMENT}
4296 @section @code{IBCLR} --- Clear bit
4297 @findex @code{IBCLR} intrinsic
4298 @cindex bit operations
4300 Intrinsic implemented, documentation pending.
4303 @item @emph{Description}:
4304 @item @emph{Standard}:
4310 @item @emph{Syntax}:
4311 @item @emph{Arguments}:
4312 @item @emph{Return value}:
4313 @item @emph{Example}:
4314 @item @emph{Specific names}:
4316 @item @emph{See also}:
4317 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4324 @section @code{IBITS} --- Bit extraction
4325 @findex @code{IBITS} intrinsic
4326 @cindex bit operations
4328 Intrinsic implemented, documentation pending.
4331 @item @emph{Description}:
4332 @item @emph{Standard}:
4338 @item @emph{Syntax}:
4339 @item @emph{Arguments}:
4340 @item @emph{Return value}:
4341 @item @emph{Example}:
4342 @item @emph{Specific names}:
4343 @item @emph{See also}:
4344 @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4352 @section @code{IBSET} --- Set bit
4353 @findex @code{IBSET} intrinsic
4354 @cindex bit operations
4356 Intrinsic implemented, documentation pending.
4359 @item @emph{Description}:
4360 @item @emph{Standard}:
4366 @item @emph{Syntax}:
4367 @item @emph{Arguments}:
4368 @item @emph{Return value}:
4369 @item @emph{Example}:
4370 @item @emph{Specific names}:
4372 @item @emph{See also}:
4373 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4380 @section @code{ICHAR} --- Character-to-integer conversion function
4381 @findex @code{ICHAR} intrinsic
4382 @cindex conversion function (character)
4385 @item @emph{Description}:
4386 @code{ICHAR(C)} returns the code for the character in the first character
4387 position of @code{C} in the system's native character set.
4388 The correspondence between characters and their codes is not necessarily
4389 the same across different GNU Fortran implementations.
4391 @item @emph{Standard}:
4397 @item @emph{Syntax}:
4400 @item @emph{Arguments}:
4401 @multitable @columnfractions .15 .80
4402 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4405 @item @emph{Return value}:
4406 The return value is of type @code{INTEGER} and of the default integer
4409 @item @emph{Example}:
4414 end program test_ichar
4418 No intrinsic exists to convert a printable character string to a numerical
4419 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4420 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4423 Instead, you can use internal-file I/O to do this kind of conversion. For
4428 character(len=10) string
4431 read (string,'(I10)') value
4433 end program read_val
4438 @section @code{IDATE} --- Get current local time subroutine (day/month/year)
4439 @findex @code{IDATE} intrinsic
4442 @item @emph{Description}:
4443 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4444 current local time. The day (in the range 1-31), month (in the range 1-12),
4445 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively.
4446 The year has four significant digits.
4448 @item @emph{Standard}:
4454 @item @emph{Syntax}:
4455 @code{CALL IDATE(TARRAY)}
4457 @item @emph{Arguments}:
4458 @multitable @columnfractions .15 .80
4459 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4460 the kind shall be the default integer kind.
4463 @item @emph{Return value}:
4466 @item @emph{Example}:
4469 integer, dimension(3) :: tarray
4474 end program test_idate
4481 @section @code{IEOR} --- Bitwise logical exclusive or
4482 @findex @code{IEOR} intrinsic
4483 @cindex bit operations
4485 Intrinsic implemented, documentation pending.
4488 @item @emph{Description}:
4489 @item @emph{Standard}:
4495 @item @emph{Syntax}:
4496 @item @emph{Arguments}:
4497 @item @emph{Return value}:
4498 @item @emph{Example}:
4499 @item @emph{Specific names}:
4501 @item @emph{See also}:
4502 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4509 @section @code{IERRNO} --- Get the last system error number
4510 @findex @code{IERRNO} intrinsic
4511 @cindex undocumented intrinsic
4513 Intrinsic implemented, documentation pending.
4516 @item @emph{Description}:
4517 @item @emph{Standard}:
4521 @item @emph{Syntax}:
4522 @item @emph{Arguments}:
4523 @item @emph{Return value}:
4524 @item @emph{Example}:
4526 @item @emph{See also}:
4534 @section @code{INDEX} --- Position of a substring within a string
4535 @findex @code{INDEX} intrinsic
4536 @cindex undocumented intrinsic
4538 Intrinsic implemented, documentation pending.
4541 @item @emph{Description}:
4542 @item @emph{Standard}:
4548 @item @emph{Syntax}:
4549 @item @emph{Arguments}:
4550 @item @emph{Return value}:
4551 @item @emph{Example}:
4552 @item @emph{Specific names}:
4553 @item @emph{See also}:
4560 @section @code{INT} --- Convert to integer type
4561 @findex @code{INT} intrinsic
4562 @findex @code{IFIX} intrinsic
4563 @findex @code{IDINT} intrinsic
4564 @cindex conversion function (integer)
4567 @item @emph{Description}:
4568 Convert to integer type
4570 @item @emph{Standard}:
4576 @item @emph{Syntax}:
4577 @multitable @columnfractions .30 .80
4578 @item @code{X = INT(X)}
4579 @item @code{X = INT(X, KIND)}
4582 @item @emph{Arguments}:
4583 @multitable @columnfractions .15 .80
4584 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or @code{COMPLEX(*)}
4585 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
4588 @item @emph{Return value}:
4589 These functions return a @code{INTEGER(*)} variable or array under
4590 the following rules:
4594 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X}
4596 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}.
4597 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed
4598 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4600 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4603 @item @emph{Example}:
4607 complex :: z = (-3.7, 1.0)
4609 print *, int(z), int(z,8)
4613 @item @emph{Specific names}:
4614 @multitable @columnfractions .20 .20 .20 .40
4615 @item Name @tab Argument @tab Return type @tab Standard
4616 @item @code{IFIX(X)} @tab @code{REAL(4) X} @tab @code{INTEGER} @tab F77 and later
4617 @item @code{IDINT(X)} @tab @code{REAL(8) X} @tab @code{INTEGER} @tab F77 and later
4620 @comment @item @emph{See also}:
4627 @section @code{IOR} --- Bitwise logical or
4628 @findex @code{IOR} intrinsic
4629 @cindex bit operations
4631 Intrinsic implemented, documentation pending.
4634 @item @emph{Description}:
4635 @item @emph{Standard}:
4641 @item @emph{Syntax}:
4642 @item @emph{Arguments}:
4643 @item @emph{Return value}:
4644 @item @emph{Example}:
4645 @item @emph{Specific names}:
4647 @item @emph{See also}:
4648 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4655 @section @code{IRAND} --- Integer pseudo-random number
4656 @findex @code{IRAND} intrinsic
4657 @cindex random number
4660 @item @emph{Description}:
4661 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
4662 distribution between 0 and a system-dependent limit (which is in most
4663 cases 2147483647). If @var{FLAG} is 0, the next number
4664 in the current sequence is returned; if @var{FLAG} is 1, the generator
4665 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
4666 it is used as a new seed with @code{SRAND}.
4668 @item @emph{Standard}:
4672 non-elemental function
4674 @item @emph{Syntax}:
4675 @code{I = IRAND(FLAG)}
4677 @item @emph{Arguments}:
4678 @multitable @columnfractions .15 .80
4679 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
4682 @item @emph{Return value}:
4683 The return value is of @code{INTEGER(kind=4)} type.
4685 @item @emph{Example}:
4688 integer,parameter :: seed = 86456
4691 print *, irand(), irand(), irand(), irand()
4692 print *, irand(seed), irand(), irand(), irand()
4693 end program test_irand
4701 @section @code{ISHFT} --- Shift bits
4702 @findex @code{ISHFT} intrinsic
4703 @cindex bit manipulation
4705 Intrinsic implemented, documentation pending.
4708 @item @emph{Description}:
4709 @item @emph{Standard}:
4715 @item @emph{Syntax}:
4716 @item @emph{Arguments}:
4717 @item @emph{Return value}:
4718 @item @emph{Example}:
4719 @item @emph{Specific names}:
4721 @item @emph{See also}:
4729 @section @code{ISHFTC} --- Shift bits circularly
4730 @findex @code{ISHFTC} intrinsic
4731 @cindex bit manipulation
4733 Intrinsic implemented, documentation pending.
4736 @item @emph{Description}:
4737 @item @emph{Standard}:
4743 @item @emph{Syntax}:
4744 @item @emph{Arguments}:
4745 @item @emph{Return value}:
4746 @item @emph{Example}:
4747 @item @emph{Specific names}:
4749 @item @emph{See also}:
4756 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
4757 @findex @code{ITIME} intrinsic
4760 @item @emph{Description}:
4761 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4762 current local time. The hour (in the range 1-24), minute (in the range 1-60),
4763 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY},
4766 @item @emph{Standard}:
4772 @item @emph{Syntax}:
4773 @code{CALL ITIME(TARRAY)}
4775 @item @emph{Arguments}:
4776 @multitable @columnfractions .15 .80
4777 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
4778 and the kind shall be the default integer kind.
4781 @item @emph{Return value}:
4785 @item @emph{Example}:
4788 integer, dimension(3) :: tarray
4793 end program test_itime
4800 @section @code{KILL} --- Send a signal to a process
4801 @findex @code{KILL} intrinsic
4802 @cindex undocumented intrinsic
4804 Intrinsic implemented, documentation pending.
4807 @item @emph{Description}:
4808 @item @emph{Standard}:
4814 @item @emph{Syntax}:
4815 @item @emph{Arguments}:
4816 @item @emph{Return value}:
4817 @item @emph{Example}:
4818 @item @emph{Specific names}:
4820 @item @emph{See also}:
4821 @ref{ABORT}, @ref{EXIT}
4827 @section @code{KIND} --- Kind of an entity
4828 @findex @code{KIND} intrinsic
4831 @item @emph{Description}:
4832 @code{KIND(X)} returns the kind value of the entity @var{X}.
4834 @item @emph{Standard}:
4840 @item @emph{Syntax}:
4843 @item @emph{Arguments}:
4844 @multitable @columnfractions .15 .80
4845 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
4846 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
4849 @item @emph{Return value}:
4850 The return value is a scalar of type @code{INTEGER} and of the default
4853 @item @emph{Example}:
4856 integer,parameter :: kc = kind(' ')
4857 integer,parameter :: kl = kind(.true.)
4859 print *, "The default character kind is ", kc
4860 print *, "The default logical kind is ", kl
4861 end program test_kind
4869 @section @code{LBOUND} --- Lower dimension bounds of an array
4870 @findex @code{LBOUND} intrinsic
4871 @cindex undocumented intrinsic
4873 Intrinsic implemented, documentation pending.
4876 @item @emph{Description}:
4877 @item @emph{Standard}:
4883 @item @emph{Syntax}:
4884 @item @emph{Arguments}:
4885 @item @emph{Return value}:
4886 @item @emph{Example}:
4887 @item @emph{See also}:
4895 @section @code{LEN} --- Length of a character entity
4896 @findex @code{LEN} intrinsic
4897 @cindex undocumented intrinsic
4899 Intrinsic implemented, documentation pending.
4902 @item @emph{Description}:
4903 @item @emph{Standard}:
4909 @item @emph{Syntax}:
4910 @item @emph{Arguments}:
4911 @item @emph{Return value}:
4912 @item @emph{Example}:
4913 @item @emph{Specific names}:
4915 @item @emph{See also}:
4916 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
4923 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
4924 @findex @code{LEN_TRIM} intrinsic
4925 @cindex undocumented intrinsic
4927 Intrinsic implemented, documentation pending.
4930 @item @emph{Description}:
4931 @item @emph{Standard}:
4937 @item @emph{Syntax}:
4938 @item @emph{Arguments}:
4939 @item @emph{Return value}:
4940 @item @emph{Example}:
4942 @item @emph{See also}:
4943 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
4950 @section @code{LGE} --- Lexical greater than or equal
4951 @findex @code{LGE} intrinsic
4952 @cindex comparison (lexical)
4954 Intrinsic implemented, documentation pending.
4957 @item @emph{Description}:
4958 @item @emph{Standard}:
4964 @item @emph{Syntax}:
4965 @item @emph{Arguments}:
4966 @item @emph{Return value}:
4967 @item @emph{Example}:
4969 @item @emph{See also}:
4970 @ref{LGT}, @ref{LLE}, @ref{LLT}
4977 @section @code{LGT} --- Lexical greater than
4978 @findex @code{LGT} intrinsic
4979 @cindex comparison (lexical)
4981 Intrinsic implemented, documentation pending.
4984 @item @emph{Description}:
4985 @item @emph{Standard}:
4991 @item @emph{Syntax}:
4992 @item @emph{Arguments}:
4993 @item @emph{Return value}:
4994 @item @emph{Example}:
4996 @item @emph{See also}:
4997 @ref{LGE}, @ref{LLE}, @ref{LLT}
5004 @section @code{LINK} --- Create a hard link
5005 @findex @code{LINK} intrinsic
5006 @cindex file system operations
5008 Intrinsic implemented, documentation pending.
5011 @item @emph{Description}:
5012 @item @emph{Standard}:
5018 @item @emph{Syntax}:
5019 @item @emph{Arguments}:
5020 @item @emph{Return value}:
5021 @item @emph{Example}:
5022 @item @emph{Specific names}:
5024 @item @emph{See also}:
5032 @section @code{LLE} --- Lexical less than or equal
5033 @findex @code{LLE} intrinsic
5034 @cindex comparison (lexical)
5036 Intrinsic implemented, documentation pending.
5039 @item @emph{Description}:
5040 @item @emph{Standard}:
5046 @item @emph{Syntax}:
5047 @item @emph{Arguments}:
5048 @item @emph{Return value}:
5049 @item @emph{Example}:
5051 @item @emph{See also}:
5052 @ref{LGE}, @ref{LGT}, @ref{LLT}
5059 @section @code{LLT} --- Lexical less than
5060 @findex @code{LLT} intrinsic
5061 @cindex comparison (lexical)
5063 Intrinsic implemented, documentation pending.
5066 @item @emph{Description}:
5067 @item @emph{Standard}:
5073 @item @emph{Syntax}:
5074 @item @emph{Arguments}:
5075 @item @emph{Return value}:
5076 @item @emph{Example}:
5078 @item @emph{See also}:
5079 @ref{LGE}, @ref{LGT}, @ref{LLE}
5086 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5087 @findex @code{LNBLNK} intrinsic
5088 @cindex undocumented intrinsic
5090 Intrinsic implemented, documentation pending.
5093 @item @emph{Description}:
5094 @item @emph{Standard}:
5098 @item @emph{Syntax}:
5099 @item @emph{Arguments}:
5100 @item @emph{Return value}:
5101 @item @emph{Example}:
5102 @item @emph{Specific names}:
5104 @item @emph{See also}:
5112 @section @code{LOC} --- Returns the address of a variable
5113 @findex @code{LOC} intrinsic
5117 @item @emph{Description}:
5118 @code{LOC(X)} returns the address of @var{X} as an integer.
5120 @item @emph{Standard}:
5126 @item @emph{Syntax}:
5129 @item @emph{Arguments}:
5130 @multitable @columnfractions .15 .80
5131 @item @var{X} @tab Variable of any type.
5134 @item @emph{Return value}:
5135 The return value is of type @code{INTEGER(n)}, where @code{n} is the
5136 size (in bytes) of a memory address on the target machine.
5138 @item @emph{Example}:
5145 end program test_loc
5150 @section @code{LOG} --- Logarithm function
5151 @findex @code{LOG} intrinsic
5152 @findex @code{ALOG} intrinsic
5153 @findex @code{DLOG} intrinsic
5154 @findex @code{CLOG} intrinsic
5155 @findex @code{ZLOG} intrinsic
5156 @findex @code{CDLOG} intrinsic
5160 @item @emph{Description}:
5161 @code{LOG(X)} computes the logarithm of @var{X}.
5163 @item @emph{Standard}:
5169 @item @emph{Syntax}:
5172 @item @emph{Arguments}:
5173 @multitable @columnfractions .15 .80
5174 @item @var{X} @tab The type shall be @code{REAL(*)} or
5178 @item @emph{Return value}:
5179 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5180 The kind type parameter is the same as @var{X}.
5182 @item @emph{Example}:
5185 real(8) :: x = 1.0_8
5186 complex :: z = (1.0, 2.0)
5189 end program test_log
5192 @item @emph{Specific names}:
5193 @multitable @columnfractions .20 .20 .20 .40
5194 @item Name @tab Argument @tab Return type @tab Standard
5195 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
5196 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
5197 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
5198 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5199 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5206 @section @code{LOG10} --- Base 10 logarithm function
5207 @findex @code{LOG10} intrinsic
5208 @findex @code{ALOG10} intrinsic
5209 @findex @code{DLOG10} intrinsic
5213 @item @emph{Description}:
5214 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5216 @item @emph{Standard}:
5222 @item @emph{Syntax}:
5225 @item @emph{Arguments}:
5226 @multitable @columnfractions .15 .80
5227 @item @var{X} @tab The type shall be @code{REAL(*)} or
5231 @item @emph{Return value}:
5232 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5233 The kind type parameter is the same as @var{X}.
5235 @item @emph{Example}:
5238 real(8) :: x = 10.0_8
5240 end program test_log10
5243 @item @emph{Specific names}:
5244 @multitable @columnfractions .20 .20 .20 .40
5245 @item Name @tab Argument @tab Return type @tab Standard
5246 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F95 and later
5247 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
5253 @section @code{LOGICAL} --- Convert to logical type
5254 @findex @code{LOGICAL} intrinsic
5255 @cindex conversion function (logical)
5257 Intrinsic implemented, documentation pending.
5260 @item @emph{Description}:
5261 @item @emph{Standard}:
5267 @item @emph{Syntax}:
5268 @item @emph{Arguments}:
5269 @item @emph{Return value}:
5270 @item @emph{Example}:
5271 @item @emph{Specific names}:
5272 @item @emph{See also}:
5279 @section @code{LSHIFT} --- Left shift bits
5280 @findex @code{LSHIFT}
5281 @cindex bit manipulation
5283 Not yet implemented in GNU Fortran.
5286 @item @emph{Description}:
5288 @item @emph{Standard}:
5294 @item @emph{Syntax}:
5295 @item @emph{Arguments}:
5296 @item @emph{Return value}:
5297 @item @emph{Example}:
5298 @item @emph{Specific names}:
5299 @item @emph{See also}:
5300 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
5307 @section @code{LTIME} --- Convert time to local time info
5308 @findex @code{LTIME}
5309 @cindex time function
5311 Not yet implemented in GNU Fortran.
5314 @item @emph{Description}:
5316 @item @emph{Standard}:
5322 @item @emph{Syntax}:
5323 @item @emph{Arguments}:
5324 @item @emph{Return value}:
5325 @item @emph{Example}:
5326 @item @emph{Specific names}:
5327 @item @emph{See also}:
5328 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
5335 @section @code{MALLOC} --- Allocate dynamic memory
5336 @findex @code{MALLOC} intrinsic
5340 @item @emph{Description}:
5341 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5342 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5343 is an extension intended to be used with Cray pointers, and is provided
5344 in GNU Fortran to allow the user to compile legacy code. For new code
5345 using Fortran 95 pointers, the memory allocation intrinsic is
5348 @item @emph{Standard}:
5352 non-elemental function
5354 @item @emph{Syntax}:
5355 @code{PTR = MALLOC(SIZE)}
5357 @item @emph{Arguments}:
5358 @multitable @columnfractions .15 .80
5359 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5362 @item @emph{Return value}:
5363 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5364 variables of type @code{INTEGER(K)} have the same size as
5365 C pointers (@code{sizeof(void *)}).
5367 @item @emph{Example}:
5368 The following example demonstrates the use of @code{MALLOC} and
5369 @code{FREE} with Cray pointers. This example is intended to run on
5370 32-bit systems, where the default integer kind is suitable to store
5371 pointers; on 64-bit systems, ptr_x would need to be declared as
5372 @code{integer(kind=8)}.
5381 ptr_x = malloc(20*8)
5383 x(i) = sqrt(1.0d0 / i)
5391 end program test_malloc
5394 @item @emph{See also}:
5400 @section @code{MATMUL} --- matrix multiplication
5401 @findex @code{MATMUL} intrinsic
5402 @cindex matrix operations
5404 Intrinsic implemented, documentation pending.
5407 @item @emph{Description}:
5408 @item @emph{Standard}:
5412 Transformational function
5414 @item @emph{Syntax}:
5415 @item @emph{Arguments}:
5416 @item @emph{Return value}:
5417 @item @emph{Example}:
5418 @item @emph{See also}:
5423 @section @code{MAX} --- Maximum value of an argument list
5424 @findex @code{MAX} intrinsic
5425 @cindex undocumented intrinsic
5427 Intrinsic implemented, documentation pending.
5430 @item @emph{Description}:
5431 @item @emph{Standard}:
5437 @item @emph{Syntax}:
5438 @item @emph{Arguments}:
5439 @item @emph{Return value}:
5440 @item @emph{Example}:
5442 @item @emph{Specific names}:
5443 @multitable @columnfractions .20 .20 .20 .40
5444 @item Name @tab Argument @tab Return type @tab Standard
5445 @item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5446 @item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
5447 @item @code{MAX1(X)} @tab @code{REAL(*) X} @tab @code{INT(MAX(X))} @tab F77 and later
5448 @item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5449 @item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5452 @item @emph{See also}:
5453 @ref{MAXLOC} @ref{MAXVAL}
5458 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
5459 @findex @code{MAXEXPONENT} intrinsic
5463 @item @emph{Description}:
5464 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
5467 @item @emph{Standard}:
5473 @item @emph{Syntax}:
5474 @code{I = MAXEXPONENT(X)}
5476 @item @emph{Arguments}:
5477 @multitable @columnfractions .15 .80
5478 @item @var{X} @tab shall be of type @code{REAL}.
5481 @item @emph{Return value}:
5482 The return value is of type @code{INTEGER} and of the default integer
5485 @item @emph{Example}:
5491 print *, minexponent(x), maxexponent(x)
5492 print *, minexponent(y), maxexponent(y)
5493 end program exponents
5499 @section @code{MAXLOC} --- Location of the maximum value within an array
5500 @findex @code{MAXLOC} intrinsic
5501 @cindex undocumented intrinsic
5503 Intrinsic implemented, documentation pending.
5506 @item @emph{Description}:
5507 @item @emph{Standard}:
5511 Transformational function
5513 @item @emph{Syntax}:
5514 @item @emph{Arguments}:
5515 @item @emph{Return value}:
5516 @item @emph{Example}:
5517 @item @emph{See also}:
5518 @ref{MAX}, @ref{MAXVAL}
5524 @section @code{MAXVAL} --- Maximum value of an array
5525 @findex @code{MAXVAL} intrinsic
5526 @cindex undocumented intrinsic
5528 Intrinsic implemented, documentation pending.
5531 @item @emph{Description}:
5532 @item @emph{Standard}:
5536 Transformational function
5538 @item @emph{Syntax}:
5539 @item @emph{Arguments}:
5540 @item @emph{Return value}:
5541 @item @emph{Example}:
5542 @item @emph{Specific names}:
5544 @item @emph{See also}:
5545 @ref{MAX}, @ref{MAXLOC}
5552 @section @code{MERGE} --- Merge arrays
5553 @findex @code{MERGE} intrinsic
5554 @cindex undocumented intrinsic
5556 Intrinsic implemented, documentation pending.
5559 @item @emph{Description}:
5560 @item @emph{Standard}:
5566 @item @emph{Syntax}:
5567 @item @emph{Arguments}:
5568 @item @emph{Return value}:
5569 @item @emph{Example}:
5570 @item @emph{Specific names}:
5571 @item @emph{See also}:
5576 @section @code{MIN} --- Minimum value of an argument list
5577 @findex @code{MIN} intrinsic
5578 @cindex undocumented intrinsic
5580 Intrinsic implemented, documentation pending.
5583 @item @emph{Description}:
5584 @item @emph{Standard}:
5590 @item @emph{Syntax}:
5591 @item @emph{Arguments}:
5592 @item @emph{Return value}:
5593 @item @emph{Example}:
5595 @item @emph{Specific names}:
5596 @multitable @columnfractions .20 .20 .20 .40
5597 @item Name @tab Argument @tab Return type @tab Standard
5598 @item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
5599 @item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
5600 @item @code{MIN1(X)} @tab @code{REAL(*) X} @tab @code{INT(MIN(X))} @tab F77 and later
5601 @item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
5602 @item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
5605 @item @emph{See also}:
5606 @ref{MINLOC}, @ref{MINVAL}
5610 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
5611 @findex @code{MINEXPONENT} intrinsic
5615 @item @emph{Description}:
5616 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
5619 @item @emph{Standard}:
5625 @item @emph{Syntax}:
5626 @code{I = MINEXPONENT(X)}
5628 @item @emph{Arguments}:
5629 @multitable @columnfractions .15 .80
5630 @item @var{X} @tab shall be of type @code{REAL}.
5633 @item @emph{Return value}:
5634 The return value is of type @code{INTEGER} and of the default integer
5637 @item @emph{Example}:
5638 See @code{MAXEXPONENT} for an example.
5643 @section @code{MINLOC} --- Location of the minimum value within an array
5644 @findex @code{MINLOC} intrinsic
5645 @cindex undocumented intrinsic
5647 Intrinsic implemented, documentation pending.
5650 @item @emph{Description}:
5651 @item @emph{Standard}:
5655 Transformational function
5657 @item @emph{Syntax}:
5658 @item @emph{Arguments}:
5659 @item @emph{Return value}:
5660 @item @emph{Example}:
5662 @item @emph{See also}:
5663 @ref{MIN}, @ref{MINVAL}
5669 @section @code{MINVAL} --- Minimum value of an array
5670 @findex @code{MINVAL} intrinsic
5671 @cindex undocumented intrinsic
5673 Intrinsic implemented, documentation pending.
5676 @item @emph{Description}:
5677 @item @emph{Standard}:
5681 Transformational function
5683 @item @emph{Syntax}:
5684 @item @emph{Arguments}:
5685 @item @emph{Return value}:
5686 @item @emph{Example}:
5688 @item @emph{See also}:
5689 @ref{MIN}, @ref{MINLOC}
5696 @section @code{MOD} --- Remainder function
5697 @findex @code{MOD} intrinsic
5698 @findex @code{AMOD} intrinsic
5699 @findex @code{DMOD} intrinsic
5703 @item @emph{Description}:
5704 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
5705 calculated as @code{A - (INT(A/P) * P)}.
5707 @item @emph{Standard}:
5713 @item @emph{Syntax}:
5716 @item @emph{Arguments}:
5717 @multitable @columnfractions .15 .80
5718 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5719 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
5723 @item @emph{Return value}:
5724 The kind of the return value is the result of cross-promoting
5725 the kinds of the arguments.
5727 @item @emph{Example}:
5731 print *, mod(17.5,5.5)
5732 print *, mod(17.5d0,5.5)
5733 print *, mod(17.5,5.5d0)
5736 print *, mod(-17.5,5.5)
5737 print *, mod(-17.5d0,5.5)
5738 print *, mod(-17.5,5.5d0)
5741 print *, mod(17.5,-5.5)
5742 print *, mod(17.5d0,-5.5)
5743 print *, mod(17.5,-5.5d0)
5744 end program test_mod
5747 @item @emph{Specific names}:
5748 @multitable @columnfractions .20 .20 .20 .40
5749 @item Name @tab Arguments @tab Return type @tab Standard
5750 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
5751 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
5758 @section @code{MODULO} --- Modulo function
5759 @findex @code{MODULO} intrinsic
5763 @item @emph{Description}:
5764 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
5766 @item @emph{Standard}:
5772 @item @emph{Syntax}:
5773 @code{X = MODULO(A,P)}
5775 @item @emph{Arguments}:
5776 @multitable @columnfractions .15 .80
5777 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5778 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
5781 @item @emph{Return value}:
5782 The type and kind of the result are those of the arguments.
5784 @item If @var{A} and @var{P} are of type @code{INTEGER}:
5785 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
5786 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
5788 @item If @var{A} and @var{P} are of type @code{REAL}:
5789 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
5791 In all cases, if @var{P} is zero the result is processor-dependent.
5793 @item @emph{Example}:
5796 print *, modulo(17,3)
5797 print *, modulo(17.5,5.5)
5799 print *, modulo(-17,3)
5800 print *, modulo(-17.5,5.5)
5802 print *, modulo(17,-3)
5803 print *, modulo(17.5,-5.5)
5804 end program test_mod
5812 @section @code{MVBITS} --- Move bits from one integer to another
5813 @findex @code{MVBITS} intrinsic
5814 @cindex bit operations
5816 Intrinsic implemented, documentation pending.
5819 @item @emph{Description}:
5820 @item @emph{Standard}:
5824 Elemental subroutine
5826 @item @emph{Syntax}:
5827 @item @emph{Arguments}:
5828 @item @emph{Return value}:
5829 @item @emph{Example}:
5830 @item @emph{See also}:
5837 @section @code{NEAREST} --- Nearest representable number
5838 @findex @code{NEAREST} intrinsic
5839 @cindex processor-representable number
5842 @item @emph{Description}:
5843 @code{NEAREST(X, S)} returns the processor-representable number nearest
5844 to @code{X} in the direction indicated by the sign of @code{S}.
5846 @item @emph{Standard}:
5852 @item @emph{Syntax}:
5853 @code{Y = NEAREST(X, S)}
5855 @item @emph{Arguments}:
5856 @multitable @columnfractions .15 .80
5857 @item @var{X} @tab shall be of type @code{REAL}.
5858 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
5862 @item @emph{Return value}:
5863 The return value is of the same type as @code{X}. If @code{S} is
5864 positive, @code{NEAREST} returns the processor-representable number
5865 greater than @code{X} and nearest to it. If @code{S} is negative,
5866 @code{NEAREST} returns the processor-representable number smaller than
5867 @code{X} and nearest to it.
5869 @item @emph{Example}:
5871 program test_nearest
5873 x = nearest(42.0, 1.0)
5874 y = nearest(42.0, -1.0)
5875 write (*,"(3(G20.15))") x, y, x - y
5876 end program test_nearest
5883 @section @code{NINT} --- Nearest whole number
5884 @findex @code{NINT} intrinsic
5885 @findex @code{IDNINT} intrinsic
5886 @cindex whole number
5889 @item @emph{Description}:
5890 @code{NINT(X)} rounds its argument to the nearest whole number.
5892 @item @emph{Standard}:
5898 @item @emph{Syntax}:
5901 @item @emph{Arguments}:
5902 @multitable @columnfractions .15 .80
5903 @item @var{X} @tab The type of the argument shall be @code{REAL}.
5906 @item @emph{Return value}:
5907 Returns @var{A} with the fractional portion of its magnitude eliminated by
5908 rounding to the nearest whole number and with its sign preserved,
5909 converted to an @code{INTEGER} of the default kind.
5911 @item @emph{Example}:
5918 print *, nint(x4), idnint(x8)
5919 end program test_nint
5922 @item @emph{Specific names}:
5923 @multitable @columnfractions .33 .33 .33
5924 @item Name @tab Argument @tab Standard
5925 @item @code{IDNINT(X)} @tab @code{REAL(8)} @tab F95 and later
5928 @item @emph{See also}:
5929 @ref{CEILING}, @ref{FLOOR}
5935 @section @code{NOT} --- Logical negation
5936 @findex @code{NOT} intrinsic
5937 @cindex logical operations
5939 Intrinsic implemented, documentation pending.
5942 @item @emph{Description}:
5943 @item @emph{Standard}:
5949 @item @emph{Syntax}:
5950 @item @emph{Arguments}:
5951 @item @emph{Return value}:
5952 @item @emph{Example}:
5953 @item @emph{See also}:
5960 @section @code{NULL} --- Function that returns an disassociated pointer
5961 @findex @code{NULL} intrinsic
5962 @cindex undocumented intrinsic
5964 Intrinsic implemented, documentation pending.
5967 @item @emph{Description}:
5968 @item @emph{Standard}:
5972 Transformational function
5974 @item @emph{Syntax}:
5975 @item @emph{Arguments}:
5976 @item @emph{Return value}:
5977 @item @emph{Example}:
5978 @item @emph{See also}:
5986 @section @code{OR} --- Bitwise logical OR
5987 @findex @code{OR} intrinsic
5988 @cindex bit operations
5991 @item @emph{Description}:
5992 Bitwise logical @code{OR}.
5994 This intrinsic routine is provided for backwards compatibility with
5995 GNU Fortran 77. For integer arguments, programmers should consider
5996 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
5998 @item @emph{Standard}:
6002 Non-elemental function
6004 @item @emph{Syntax}:
6005 @code{RESULT = OR(X, Y)}
6007 @item @emph{Arguments}:
6008 @multitable @columnfractions .15 .80
6009 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6010 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6013 @item @emph{Return value}:
6014 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
6015 after cross-promotion of the arguments.
6017 @item @emph{Example}:
6020 LOGICAL :: T = .TRUE., F = ..FALSE.
6022 DATA a / Z'F' /, b / Z'3' /
6024 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6025 WRITE (*,*) OR(a, b)
6029 @item @emph{See also}:
6030 F95 elemental function: @ref{IOR}
6037 @section @code{PACK} --- Pack an array into an array of rank one
6038 @findex @code{PACK} intrinsic
6039 @cindex undocumented intrinsic
6041 Intrinsic implemented, documentation pending.
6044 @item @emph{Description}:
6045 @item @emph{Standard}:
6049 Transformational function
6051 @item @emph{Syntax}:
6052 @item @emph{Arguments}:
6053 @item @emph{Return value}:
6054 @item @emph{Example}:
6055 @item @emph{Specific names}:
6056 @item @emph{See also}:
6064 @section @code{PERROR} --- Print system error message
6065 @findex @code{PERROR} intrinsic
6066 @cindex undocumented intrinsic
6068 Intrinsic implemented, documentation pending.
6071 @item @emph{Description}:
6072 @item @emph{Standard}:
6078 @item @emph{Syntax}:
6079 @item @emph{Arguments}:
6080 @item @emph{Return value}:
6081 @item @emph{Example}:
6082 @item @emph{Specific names}:
6083 @item @emph{See also}:
6091 @section @code{PRECISION} --- Decimal precision of a real kind
6092 @findex @code{PRECISION} intrinsic
6096 @item @emph{Description}:
6097 @code{PRECISION(X)} returns the decimal precision in the model of the
6100 @item @emph{Standard}:
6106 @item @emph{Syntax}:
6107 @code{I = PRECISION(X)}
6109 @item @emph{Arguments}:
6110 @multitable @columnfractions .15 .80
6111 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6114 @item @emph{Return value}:
6115 The return value is of type @code{INTEGER} and of the default integer
6118 @item @emph{Example}:
6120 program prec_and_range
6121 real(kind=4) :: x(2)
6122 complex(kind=8) :: y
6124 print *, precision(x), range(x)
6125 print *, precision(y), range(y)
6126 end program prec_and_range
6133 @section @code{PRESENT} --- Determine whether an optional argument is specified
6134 @findex @code{PRESENT} intrinsic
6135 @cindex undocumented intrinsic
6137 Intrinsic implemented, documentation pending.
6140 @item @emph{Description}:
6141 @item @emph{Standard}:
6147 @item @emph{Syntax}:
6148 @item @emph{Arguments}:
6149 @item @emph{Return value}:
6150 @item @emph{Example}:
6151 @item @emph{See also}:
6158 @section @code{PRODUCT} --- Product of array elements
6159 @findex @code{PRODUCT} intrinsic
6160 @cindex undocumented intrinsic
6162 Intrinsic implemented, documentation pending.
6165 @item @emph{Description}:
6166 @item @emph{Standard}:
6170 Transformational function
6172 @item @emph{Syntax}:
6173 @item @emph{Arguments}:
6174 @item @emph{Return value}:
6175 @item @emph{Example}:
6176 @item @emph{Specific names}:
6177 @item @emph{See also}:
6185 @section @code{RADIX} --- Base of a model number
6186 @findex @code{RADIX} intrinsic
6190 @item @emph{Description}:
6191 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6193 @item @emph{Standard}:
6199 @item @emph{Syntax}:
6202 @item @emph{Arguments}:
6203 @multitable @columnfractions .15 .80
6204 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6207 @item @emph{Return value}:
6208 The return value is a scalar of type @code{INTEGER} and of the default
6211 @item @emph{Example}:
6214 print *, "The radix for the default integer kind is", radix(0)
6215 print *, "The radix for the default real kind is", radix(0.0)
6216 end program test_radix
6224 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6225 @findex @code{RANDOM_NUMBER} intrinsic
6226 @cindex random numbers
6228 Intrinsic implemented, documentation pending.
6231 @item @emph{Description}:
6232 @item @emph{Standard}:
6236 Elemental subroutine
6238 @item @emph{Syntax}:
6239 @item @emph{Arguments}:
6240 @item @emph{Return value}:
6241 @item @emph{Example}:
6242 @item @emph{See also}:
6250 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6251 @findex @code{RANDOM_SEED} intrinsic
6252 @cindex random numbers
6254 Intrinsic implemented, documentation pending.
6257 @item @emph{Description}:
6258 @item @emph{Standard}:
6264 @item @emph{Syntax}:
6265 @item @emph{Arguments}:
6266 @item @emph{Return value}:
6267 @item @emph{Example}:
6268 @item @emph{See also}:
6276 @section @code{RAND} --- Real pseudo-random number
6277 @findex @code{RAND} intrinsic
6278 @findex @code{RAN} intrinsic
6279 @cindex random number
6282 @item @emph{Description}:
6283 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6284 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6285 in the current sequence is returned; if @var{FLAG} is 1, the generator
6286 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6287 it is used as a new seed with @code{SRAND}.
6289 @item @emph{Standard}:
6293 non-elemental function
6295 @item @emph{Syntax}:
6296 @code{X = RAND(FLAG)}
6298 @item @emph{Arguments}:
6299 @multitable @columnfractions .15 .80
6300 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6303 @item @emph{Return value}:
6304 The return value is of @code{REAL} type and the default kind.
6306 @item @emph{Example}:
6309 integer,parameter :: seed = 86456
6312 print *, rand(), rand(), rand(), rand()
6313 print *, rand(seed), rand(), rand(), rand()
6314 end program test_rand
6318 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6319 provided as an alias for @code{RAND}.
6321 @item @emph{See also}:
6322 @ref{SRAND}, @ref{RANDOM_NUMBER}
6329 @section @code{RANGE} --- Decimal exponent range of a real kind
6330 @findex @code{RANGE} intrinsic
6334 @item @emph{Description}:
6335 @code{RANGE(X)} returns the decimal exponent range in the model of the
6338 @item @emph{Standard}:
6344 @item @emph{Syntax}:
6347 @item @emph{Arguments}:
6348 @multitable @columnfractions .15 .80
6349 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6352 @item @emph{Return value}:
6353 The return value is of type @code{INTEGER} and of the default integer
6356 @item @emph{Example}:
6357 See @code{PRECISION} for an example.
6363 @section @code{RAN} --- Real pseudo-random number
6364 @findex @code{RAN} intrinsic
6365 @cindex random number
6368 @item @emph{Standard}:
6371 @item @emph{See also}:
6372 @ref{RAND}, @ref{RANDOM_NUMBER}
6378 @section @code{REAL} --- Convert to real type
6379 @findex @code{REAL} intrinsic
6380 @findex @code{REALPART} intrinsic
6384 @item @emph{Description}:
6385 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
6386 @code{REALPART(X)} function is provided for compatibility with @command{g77},
6387 and its use is strongly discouraged.
6389 @item @emph{Standard}:
6395 @item @emph{Syntax}:
6396 @multitable @columnfractions .30 .80
6397 @item @code{X = REAL(X)}
6398 @item @code{X = REAL(X, KIND)}
6399 @item @code{X = REALPART(Z)}
6402 @item @emph{Arguments}:
6403 @multitable @columnfractions .15 .80
6404 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
6406 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
6409 @item @emph{Return value}:
6410 These functions return a @code{REAL(*)} variable or array under
6411 the following rules:
6415 @code{REAL(X)} is converted to a default real type if @var{X} is an
6416 integer or real variable.
6418 @code{REAL(X)} is converted to a real type with the kind type parameter
6419 of @var{X} if @var{X} is a complex variable.
6421 @code{REAL(X, KIND)} is converted to a real type with kind type
6422 parameter @var{KIND} if @var{X} is a complex, integer, or real
6426 @item @emph{Example}:
6429 complex :: x = (1.0, 2.0)
6430 print *, real(x), real(x,8), realpart(x)
6431 end program test_real
6434 @item @emph{See also}:
6435 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
6441 @section @code{RENAME} --- Rename a file
6442 @findex @code{RENAME} intrinsic
6443 @cindex file system operations
6445 Intrinsic implemented, documentation pending.
6448 @item @emph{Description}:
6449 @item @emph{Standard}:
6455 @item @emph{Syntax}:
6456 @item @emph{Arguments}:
6457 @item @emph{Return value}:
6458 @item @emph{Example}:
6459 @item @emph{See also}:
6466 @section @code{REPEAT} --- Repeated string concatenation
6467 @findex @code{REPEAT} intrinsic
6468 @cindex string manipulation
6470 Intrinsic implemented, documentation pending.
6473 @item @emph{Description}:
6474 @item @emph{Standard}:
6478 Transformational function
6480 @item @emph{Syntax}:
6481 @item @emph{Arguments}:
6482 @item @emph{Return value}:
6483 @item @emph{Example}:
6484 @item @emph{See also}:
6491 @section @code{RESHAPE} --- Function to reshape an array
6492 @findex @code{RESHAPE} intrinsic
6493 @cindex array manipulation
6495 Intrinsic implemented, documentation pending.
6498 @item @emph{Description}:
6499 @item @emph{Standard}:
6503 Transformational function
6505 @item @emph{Syntax}:
6506 @item @emph{Arguments}:
6507 @item @emph{Return value}:
6508 @item @emph{Example}:
6509 @item @emph{See also}:
6516 @section @code{RRSPACING} --- Reciprocal of the relative spacing
6517 @findex @code{RRSPACING} intrinsic
6520 @item @emph{Description}:
6521 @code{RRSPACING(X)} returns the reciprocal of the relative spacing of
6522 model numbers near @var{X}.
6524 @item @emph{Standard}:
6530 @item @emph{Syntax}:
6531 @code{Y = RRSPACING(X)}
6533 @item @emph{Arguments}:
6534 @multitable @columnfractions .15 .80
6535 @item @var{X} @tab shall be of type @code{REAL}.
6538 @item @emph{Return value}:
6539 The return value is of the same type and kind as @var{X}.
6540 The value returned is equal to
6541 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
6548 @section @code{RSHIFT} --- Right shift bits
6549 @findex @code{RSHIFT}
6550 @cindex bit manipulation
6552 Not yet implemented in GNU Fortran.
6555 @item @emph{Description}:
6557 @item @emph{Standard}:
6563 @item @emph{Syntax}:
6564 @item @emph{Arguments}:
6565 @item @emph{Return value}:
6566 @item @emph{Example}:
6567 @item @emph{See also}:
6568 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
6575 @section @code{SCALE} --- Scale a real value
6576 @findex @code{SCALE} intrinsic
6579 @item @emph{Description}:
6580 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
6582 @item @emph{Standard}:
6588 @item @emph{Syntax}:
6589 @code{Y = SCALE(X, I)}
6591 @item @emph{Arguments}:
6592 @multitable @columnfractions .15 .80
6593 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
6594 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
6597 @item @emph{Return value}:
6598 The return value is of the same type and kind as @var{X}.
6599 Its value is @code{X * RADIX(X)**I}.
6601 @item @emph{Example}:
6604 real :: x = 178.1387e-4
6606 print *, scale(x,i), x*radix(x)**i
6607 end program test_scale
6614 @section @code{SCAN} --- Scan a string for the presence of a set of characters
6615 @findex @code{SCAN} intrinsic
6616 @cindex string manipulation
6618 Intrinsic implemented, documentation pending.
6621 @item @emph{Description}:
6622 @item @emph{Standard}:
6628 @item @emph{Syntax}:
6629 @item @emph{Arguments}:
6630 @item @emph{Return value}:
6631 @item @emph{Example}:
6632 @item @emph{See also}:
6639 @section @code{SECNDS} --- Time function
6640 @findex @code{SECNDS} intrinsic
6644 @item @emph{Description}:
6645 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
6646 @var{X} is a reference time, also in seconds. If this is zero, the time in
6647 seconds from midnight is returned. This function is non-standard and its
6650 @item @emph{Standard}:
6656 @item @emph{Syntax}:
6657 @code{T = SECNDS (X)}
6659 @item @emph{Arguments}:
6660 @multitable @columnfractions .15 .80
6661 @item Name @tab Type
6662 @item @var{T} @tab REAL(4)
6663 @item @var{X} @tab REAL(4)
6666 @item @emph{Return value}:
6669 @item @emph{Example}:
6673 print *, secnds (0.0) ! seconds since midnight
6674 t1 = secnds (0.0) ! reference time
6675 do i = 1, 10000000 ! do something
6677 t2 = secnds (t1) ! elapsed time
6678 print *, "Something took ", t2, " seconds."
6679 end program test_secnds
6685 @node SELECTED_INT_KIND
6686 @section @code{SELECTED_INT_KIND} --- Choose integer kind
6687 @findex @code{SELECTED_INT_KIND} intrinsic
6688 @cindex integer kind
6691 @item @emph{Description}:
6692 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
6693 type that can represent all values ranging from @math{-10^I} (exclusive)
6694 to @math{10^I} (exclusive). If there is no integer kind that accommodates
6695 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
6697 @item @emph{Standard}:
6701 Transformational function
6703 @item @emph{Syntax}:
6704 @multitable @columnfractions .30 .80
6705 @item @code{J = SELECTED_INT_KIND(I)}
6708 @item @emph{Arguments}:
6709 @multitable @columnfractions .15 .80
6710 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
6713 @item @emph{Example}:
6715 program large_integers
6716 integer,parameter :: k5 = selected_int_kind(5)
6717 integer,parameter :: k15 = selected_int_kind(15)
6718 integer(kind=k5) :: i5
6719 integer(kind=k15) :: i15
6721 print *, huge(i5), huge(i15)
6723 ! The following inequalities are always true
6724 print *, huge(i5) >= 10_k5**5-1
6725 print *, huge(i15) >= 10_k15**15-1
6726 end program large_integers
6732 @node SELECTED_REAL_KIND
6733 @section @code{SELECTED_REAL_KIND} --- Choose real kind
6734 @findex @code{SELECTED_REAL_KIND} intrinsic
6738 @item @emph{Description}:
6739 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
6740 with decimal precision greater of at least @code{P} digits and exponent
6741 range greater at least @code{R}.
6743 @item @emph{Standard}:
6747 Transformational function
6749 @item @emph{Syntax}:
6750 @multitable @columnfractions .30 .80
6751 @item @code{I = SELECTED_REAL_KIND(P,R)}
6754 @item @emph{Arguments}:
6755 @multitable @columnfractions .15 .80
6756 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
6757 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
6759 At least one argument shall be present.
6761 @item @emph{Return value}:
6763 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
6764 a real data type with decimal precision of at least @code{P} digits and a
6765 decimal exponent range of at least @code{R}. If more than one real data
6766 type meet the criteria, the kind of the data type with the smallest
6767 decimal precision is returned. If no real data type matches the criteria,
6770 @item -1 if the processor does not support a real data type with a
6771 precision greater than or equal to @code{P}
6772 @item -2 if the processor does not support a real type with an exponent
6773 range greater than or equal to @code{R}
6774 @item -3 if neither is supported.
6777 @item @emph{Example}:
6780 integer,parameter :: p6 = selected_real_kind(6)
6781 integer,parameter :: p10r100 = selected_real_kind(10,100)
6782 integer,parameter :: r400 = selected_real_kind(r=400)
6784 real(kind=p10r100) :: y
6785 real(kind=r400) :: z
6787 print *, precision(x), range(x)
6788 print *, precision(y), range(y)
6789 print *, precision(z), range(z)
6790 end program real_kinds
6797 @section @code{SET_EXPONENT} --- Set the exponent of the model
6798 @findex @code{SET_EXPONENT} intrinsic
6802 @item @emph{Description}:
6803 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
6804 is that that of @var{X} and whose exponent part if @var{I}.
6806 @item @emph{Standard}:
6812 @item @emph{Syntax}:
6813 @code{Y = SET_EXPONENT(X, I)}
6815 @item @emph{Arguments}:
6816 @multitable @columnfractions .15 .80
6817 @item @var{X} @tab shall be of type @code{REAL}.
6818 @item @var{I} @tab shall be of type @code{INTEGER}.
6821 @item @emph{Return value}:
6822 The return value is of the same type and kind as @var{X}.
6823 The real number whose fractional part
6824 is that that of @var{X} and whose exponent part if @var{I} is returned;
6825 it is @code{FRACTION(X) * RADIX(X)**I}.
6827 @item @emph{Example}:
6830 real :: x = 178.1387e-4
6832 print *, set_exponent(x), fraction(x) * radix(x)**i
6833 end program test_setexp
6841 @section @code{SHAPE} --- Determine the shape of an array
6842 @findex @code{SHAPE} intrinsic
6843 @cindex array manipulation
6845 Intrinsic implemented, documentation pending.
6848 @item @emph{Description}:
6849 @item @emph{Standard}:
6855 @item @emph{Syntax}:
6856 @item @emph{Arguments}:
6857 @item @emph{Return value}:
6858 @item @emph{Example}:
6859 @item @emph{See also}:
6867 @section @code{SIGN} --- Sign copying function
6868 @findex @code{SIGN} intrinsic
6869 @findex @code{ISIGN} intrinsic
6870 @findex @code{DSIGN} intrinsic
6871 @cindex sign copying
6874 @item @emph{Description}:
6875 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
6877 @item @emph{Standard}:
6883 @item @emph{Syntax}:
6884 @code{X = SIGN(A,B)}
6886 @item @emph{Arguments}:
6887 @multitable @columnfractions .15 .80
6888 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6889 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
6892 @item @emph{Return value}:
6893 The kind of the return value is that of @var{A} and @var{B}.
6894 If @math{B\ge 0} then the result is @code{ABS(A)}, else
6895 it is @code{-ABS(A)}.
6897 @item @emph{Example}:
6900 print *, sign(-12,1)
6901 print *, sign(-12,0)
6902 print *, sign(-12,-1)
6904 print *, sign(-12.,1.)
6905 print *, sign(-12.,0.)
6906 print *, sign(-12.,-1.)
6907 end program test_sign
6910 @item @emph{Specific names}:
6911 @multitable @columnfractions .20 .20 .20 .40
6912 @item Name @tab Arguments @tab Return type @tab Standard
6913 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
6914 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
6921 @section @code{SIGNAL} --- Signal handling subroutine (or function)
6922 @findex @code{SIGNAL} intrinsic
6923 @cindex SIGNAL subroutine
6926 @item @emph{Description}:
6927 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
6928 @var{HANDLER} to be executed with a single integer argument when signal
6929 @var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
6930 turn off handling of signal @var{NUMBER} or revert to its default
6931 action. See @code{signal(2)}.
6933 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
6934 is supplied, it is set to the value returned by @code{signal(2)}.
6936 @item @emph{Standard}:
6940 subroutine, non-elemental function
6942 @item @emph{Syntax}:
6943 @multitable @columnfractions .30 .80
6944 @item @code{CALL ALARM(NUMBER, HANDLER)}
6945 @item @code{CALL ALARM(NUMBER, HANDLER, STATUS)}
6946 @item @code{STATUS = ALARM(NUMBER, HANDLER)}
6949 @item @emph{Arguments}:
6950 @multitable @columnfractions .15 .80
6951 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
6952 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
6953 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
6954 @code{INTEGER}. It is @code{INTENT(IN)}.
6955 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
6956 integer. It has @code{INTENT(OUT)}.
6959 @item @emph{Return value}:
6960 The @code{SIGNAL} functions returns the value returned by @code{signal(2)}.
6962 @item @emph{Example}:
6966 external handler_print
6968 call signal (12, handler_print)
6972 end program test_signal
6980 @section @code{SIN} --- Sine function
6981 @findex @code{SIN} intrinsic
6982 @findex @code{DSIN} intrinsic
6983 @findex @code{ZSIN} intrinsic
6984 @findex @code{CDSIN} intrinsic
6985 @cindex trigonometric functions
6988 @item @emph{Description}:
6989 @code{SIN(X)} computes the sine of @var{X}.
6991 @item @emph{Standard}:
6997 @item @emph{Syntax}:
7000 @item @emph{Arguments}:
7001 @multitable @columnfractions .15 .80
7002 @item @var{X} @tab The type shall be @code{REAL(*)} or
7006 @item @emph{Return value}:
7007 The return value has same type and kind as @var{X}.
7009 @item @emph{Example}:
7014 end program test_sin
7017 @item @emph{Specific names}:
7018 @multitable @columnfractions .20 .20 .20 .40
7019 @item Name @tab Argument @tab Return type @tab Standard
7020 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
7021 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
7022 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7023 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7026 @item @emph{See also}:
7033 @section @code{SINH} --- Hyperbolic sine function
7034 @findex @code{SINH} intrinsic
7035 @findex @code{DSINH} intrinsic
7036 @cindex hyperbolic sine
7039 @item @emph{Description}:
7040 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7042 @item @emph{Standard}:
7048 @item @emph{Syntax}:
7051 @item @emph{Arguments}:
7052 @multitable @columnfractions .15 .80
7053 @item @var{X} @tab The type shall be @code{REAL(*)}.
7056 @item @emph{Return value}:
7057 The return value is of type @code{REAL(*)}.
7059 @item @emph{Example}:
7062 real(8) :: x = - 1.0_8
7064 end program test_sinh
7067 @item @emph{Specific names}:
7068 @multitable @columnfractions .20 .20 .20 .40
7069 @item Name @tab Argument @tab Return type @tab Standard
7070 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7073 @item @emph{See also}:
7080 @section @code{SIZE} --- Determine the size of an array
7081 @findex @code{SIZE} intrinsic
7082 @cindex array manipulation
7084 Intrinsic implemented, documentation pending.
7087 @item @emph{Description}:
7088 @item @emph{Standard}:
7094 @item @emph{Syntax}:
7095 @item @emph{Arguments}:
7096 @item @emph{Return value}:
7097 @item @emph{Example}:
7098 @item @emph{See also}:
7104 @section @code{SNGL} --- Convert double precision real to default real
7105 @findex @code{SNGL} intrinsic
7106 @cindex conversion function (real)
7109 @item @emph{Description}:
7110 @code{SNGL(A)} converts the double precision real @var{A}
7111 to a default real value. This is an archaic form of @code{REAL}
7112 that is specific to one type for @var{A}.
7114 @item @emph{Standard}:
7120 @item @emph{Syntax}:
7123 @item @emph{Arguments}:
7124 @multitable @columnfractions .15 .80
7125 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7128 @item @emph{Return value}:
7129 The return value is of type default @code{REAL}.
7131 @item @emph{See also}:
7138 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7139 @findex @code{SPACING} intrinsic
7140 @cindex undocumented intrinsic
7142 Intrinsic implemented, documentation pending.
7145 @item @emph{Description}:
7146 @item @emph{Standard}:
7152 @item @emph{Syntax}:
7153 @item @emph{Arguments}:
7154 @item @emph{Return value}:
7155 @item @emph{Example}:
7156 @item @emph{See also}:
7163 @section @code{SPREAD} --- Add a dimension to an array
7164 @findex @code{SPREAD} intrinsic
7165 @cindex array manipulation
7167 Intrinsic implemented, documentation pending.
7170 @item @emph{Description}:
7171 @item @emph{Standard}:
7175 Transformational function
7177 @item @emph{Syntax}:
7178 @item @emph{Arguments}:
7179 @item @emph{Return value}:
7180 @item @emph{Example}:
7181 @item @emph{See also}:
7188 @section @code{SQRT} --- Square-root function
7189 @findex @code{SQRT} intrinsic
7190 @findex @code{DSQRT} intrinsic
7191 @findex @code{CSQRT} intrinsic
7192 @findex @code{ZSQRT} intrinsic
7193 @findex @code{CDSQRT} intrinsic
7197 @item @emph{Description}:
7198 @code{SQRT(X)} computes the square root of @var{X}.
7200 @item @emph{Standard}:
7206 @item @emph{Syntax}:
7209 @item @emph{Arguments}:
7210 @multitable @columnfractions .15 .80
7211 @item @var{X} @tab The type shall be @code{REAL(*)} or
7215 @item @emph{Return value}:
7216 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7217 The kind type parameter is the same as @var{X}.
7219 @item @emph{Example}:
7222 real(8) :: x = 2.0_8
7223 complex :: z = (1.0, 2.0)
7226 end program test_sqrt
7229 @item @emph{Specific names}:
7230 @multitable @columnfractions .20 .20 .20 .40
7231 @item Name @tab Argument @tab Return type @tab Standard
7232 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7233 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F95 and later
7234 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7235 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7242 @section @code{SRAND} --- Reinitialize the random number generator
7243 @findex @code{SRAND} intrinsic
7244 @cindex random number
7247 @item @emph{Description}:
7248 @code{SRAND} reinitializes the pseudo-random number generator
7249 called by @code{RAND} and @code{IRAND}. The new seed used by the
7250 generator is specified by the required argument @var{SEED}.
7252 @item @emph{Standard}:
7256 non-elemental subroutine
7258 @item @emph{Syntax}:
7259 @code{CALL SRAND(SEED)}
7261 @item @emph{Arguments}:
7262 @multitable @columnfractions .15 .80
7263 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7266 @item @emph{Return value}:
7269 @item @emph{Example}:
7270 See @code{RAND} and @code{IRAND} for examples.
7273 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7274 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7275 to generate pseudo-random numbers. Please note that in
7276 GNU Fortran, these two sets of intrinsics (@code{RAND},
7277 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7278 @code{RANDOM_SEED} on the other hand) access two independent
7279 pseudo-random number generators.
7281 @item @emph{See also}:
7282 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7288 @section @code{STAT} --- Get file status
7289 @findex @code{STAT} intrinsic
7290 @cindex file system operations
7292 Intrinsic implemented, documentation pending.
7295 @item @emph{Description}:
7296 @item @emph{Standard}:
7300 @item @emph{Syntax}:
7301 @item @emph{Arguments}:
7302 @item @emph{Return value}:
7303 @item @emph{Example}:
7304 @item @emph{See also}:
7312 @section @code{SUM} --- Sum of array elements
7313 @findex @code{SUM} intrinsic
7314 @cindex array manipulation
7316 Intrinsic implemented, documentation pending.
7319 @item @emph{Description}:
7320 @item @emph{Standard}:
7324 Transformational function
7326 @item @emph{Syntax}:
7327 @item @emph{Arguments}:
7328 @item @emph{Return value}:
7329 @item @emph{Example}:
7330 @item @emph{See also}:
7338 @section @code{SYMLNK} --- Create a symbolic link
7339 @findex @code{SYMLNK} intrinsic
7340 @cindex file system operations
7342 Intrinsic implemented, documentation pending.
7345 @item @emph{Description}:
7346 @item @emph{Standard}:
7350 @item @emph{Syntax}:
7351 @item @emph{Arguments}:
7352 @item @emph{Return value}:
7353 @item @emph{Example}:
7354 @item @emph{See also}:
7361 @section @code{SYSTEM} --- Execute a shell command
7362 @findex @code{SYSTEM} intrinsic
7363 @cindex undocumented intrinsic
7365 Intrinsic implemented, documentation pending.
7368 @item @emph{Description}:
7369 @item @emph{Standard}:
7375 @item @emph{Syntax}:
7376 @item @emph{Arguments}:
7377 @item @emph{Return value}:
7378 @item @emph{Example}:
7379 @item @emph{See also}:
7386 @section @code{SYSTEM_CLOCK} --- Time function
7387 @findex @code{SYSTEM_CLOCK} intrinsic
7388 @cindex time functions
7390 Intrinsic implemented, documentation pending.
7393 @item @emph{Description}:
7394 @item @emph{Standard}:
7400 @item @emph{Syntax}:
7401 @item @emph{Arguments}:
7402 @item @emph{Return value}:
7403 @item @emph{Example}:
7404 @item @emph{See also}:
7410 @section @code{TAN} --- Tangent function
7411 @findex @code{TAN} intrinsic
7412 @findex @code{DTAN} intrinsic
7413 @cindex trigonometric functions
7416 @item @emph{Description}:
7417 @code{TAN(X)} computes the tangent of @var{X}.
7419 @item @emph{Standard}:
7425 @item @emph{Syntax}:
7428 @item @emph{Arguments}:
7429 @multitable @columnfractions .15 .80
7430 @item @var{X} @tab The type shall be @code{REAL(*)}.
7433 @item @emph{Return value}:
7434 The return value is of type @code{REAL(*)}. The kind type parameter is
7435 the same as @var{X}.
7437 @item @emph{Example}:
7440 real(8) :: x = 0.165_8
7442 end program test_tan
7445 @item @emph{Specific names}:
7446 @multitable @columnfractions .20 .20 .20 .40
7447 @item Name @tab Argument @tab Return type @tab Standard
7448 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7451 @item @emph{See also}:
7458 @section @code{TANH} --- Hyperbolic tangent function
7459 @findex @code{TANH} intrinsic
7460 @findex @code{DTANH} intrinsic
7461 @cindex hyperbolic tangent
7464 @item @emph{Description}:
7465 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
7467 @item @emph{Standard}:
7473 @item @emph{Syntax}:
7476 @item @emph{Arguments}:
7477 @multitable @columnfractions .15 .80
7478 @item @var{X} @tab The type shall be @code{REAL(*)}.
7481 @item @emph{Return value}:
7482 The return value is of type @code{REAL(*)} and lies in the range
7483 @math{ - 1 \leq tanh(x) \leq 1 }.
7485 @item @emph{Example}:
7488 real(8) :: x = 2.1_8
7490 end program test_tanh
7493 @item @emph{Specific names}:
7494 @multitable @columnfractions .20 .20 .20 .40
7495 @item Name @tab Argument @tab Return type @tab Standard
7496 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7499 @item @emph{See also}:
7506 @section @code{TIME} --- Time function
7507 @findex @code{TIME} intrinsic
7508 @cindex time functions
7510 Intrinsic implemented, documentation pending.
7513 @item @emph{Description}:
7514 @item @emph{Standard}:
7518 Non-elemental function
7520 @item @emph{Syntax}:
7521 @item @emph{Arguments}:
7522 @item @emph{Return value}:
7523 @item @emph{Example}:
7524 @item @emph{See also}:
7530 @section @code{TINY} --- Smallest positive number of a real kind
7531 @findex @code{TINY} intrinsic
7535 @item @emph{Description}:
7536 @code{TINY(X)} returns the smallest positive (non zero) number
7537 in the model of the type of @code{X}.
7539 @item @emph{Standard}:
7545 @item @emph{Syntax}:
7548 @item @emph{Arguments}:
7549 @multitable @columnfractions .15 .80
7550 @item @var{X} @tab shall be of type @code{REAL}.
7553 @item @emph{Return value}:
7554 The return value is of the same type and kind as @var{X}
7556 @item @emph{Example}:
7557 See @code{HUGE} for an example.
7563 @section @code{TRANSFER} --- Transfer bit patterns
7564 @findex @code{TRANSFER} intrinsic
7565 @cindex bit manipulation
7567 Intrinsic implemented, documentation pending.
7570 @item @emph{Description}:
7571 @item @emph{Standard}:
7575 Transformational function
7577 @item @emph{Syntax}:
7578 @item @emph{Arguments}:
7579 @item @emph{Return value}:
7580 @item @emph{Example}:
7581 @item @emph{See also}:
7588 @section @code{TRANSPOSE} --- Transpose an array of rank two
7589 @findex @code{TRANSPOSE} intrinsic
7590 @cindex matrix manipulation
7592 Intrinsic implemented, documentation pending.
7595 @item @emph{Description}:
7596 @item @emph{Standard}:
7600 Transformational function
7602 @item @emph{Syntax}:
7603 @item @emph{Arguments}:
7604 @item @emph{Return value}:
7605 @item @emph{Example}:
7606 @item @emph{See also}:
7613 @section @code{TRIM} --- Function to remove trailing blank characters of a string
7614 @findex @code{TRIM} intrinsic
7615 @cindex string manipulation
7617 Intrinsic implemented, documentation pending.
7620 @item @emph{Description}:
7621 @item @emph{Standard}:
7625 Transformational function
7627 @item @emph{Syntax}:
7628 @item @emph{Arguments}:
7629 @item @emph{Return value}:
7630 @item @emph{Example}:
7631 @item @emph{See also}:
7638 @section @code{UBOUND} --- Upper dimension bounds of an array
7639 @findex @code{UBOUND} intrinsic
7640 @cindex undocumented intrinsic
7642 Intrinsic implemented, documentation pending.
7645 @item @emph{Description}:
7647 @item @emph{Standard}:
7653 @item @emph{Syntax}:
7654 @item @emph{Arguments}:
7655 @item @emph{Return value}:
7656 @item @emph{Example}:
7657 @item @emph{Specific names}:
7659 @item @emph{See also}:
7667 @section @code{UMASK} --- Set the file creation mask
7668 @findex @code{UMASK} intrinsic
7669 @cindex file system operations
7671 Intrinsic implemented, documentation pending.
7674 @item @emph{Description}:
7675 @item @emph{Standard}:
7681 @item @emph{Syntax}:
7682 @item @emph{Arguments}:
7683 @item @emph{Return value}:
7684 @item @emph{Example}:
7685 @item @emph{Specific names}:
7686 @item @emph{See also}:
7693 @section @code{UNLINK} --- Remove a file from the file system
7694 @findex @code{UNLINK} intrinsic
7695 @cindex file system operations
7697 Intrinsic implemented, documentation pending.
7700 @item @emph{Description}:
7701 @item @emph{Standard}:
7707 @item @emph{Syntax}:
7708 @item @emph{Arguments}:
7709 @item @emph{Return value}:
7710 @item @emph{Example}:
7712 @item @emph{See also}:
7720 @section @code{UNMASK} --- (?)
7721 @findex @code{UNMASK} intrinsic
7722 @cindex undocumented intrinsic
7724 Intrinsic implemented, documentation pending.
7727 @item @emph{Description}:
7728 @item @emph{Standard}:
7730 @item @emph{Syntax}:
7731 @item @emph{Arguments}:
7732 @item @emph{Return value}:
7733 @item @emph{Example}:
7734 @item @emph{Specific names}:
7735 @item @emph{See also}:
7742 @section @code{UNPACK} --- Unpack an array of rank one into an array
7743 @findex @code{UNPACK} intrinsic
7744 @cindex array manipulation
7746 Intrinsic implemented, documentation pending.
7749 @item @emph{Description}:
7750 @item @emph{Standard}:
7754 Transformational function
7756 @item @emph{Syntax}:
7757 @item @emph{Arguments}:
7758 @item @emph{Return value}:
7759 @item @emph{Example}:
7761 @item @emph{See also}:
7769 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
7770 @findex @code{VERIFY} intrinsic
7771 @cindex string manipulation
7773 Intrinsic implemented, documentation pending.
7776 @item @emph{Description}:
7777 @item @emph{Standard}:
7783 @item @emph{Syntax}:
7784 @item @emph{Arguments}:
7785 @item @emph{Return value}:
7786 @item @emph{Example}:
7787 @item @emph{Specific names}:
7788 @item @emph{See also}:
7793 @section @code{XOR} --- Bitwise logical exclusive OR
7794 @findex @code{XOR} intrinsic
7795 @cindex bit operations
7798 @item @emph{Description}:
7799 Bitwise logical exclusive or.
7801 This intrinsic routine is provided for backwards compatibility with
7802 GNU Fortran 77. For integer arguments, programmers should consider
7803 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
7805 @item @emph{Standard}:
7809 Non-elemental function
7811 @item @emph{Syntax}:
7812 @code{RESULT = XOR(X, Y)}
7814 @item @emph{Arguments}:
7815 @multitable @columnfractions .15 .80
7816 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
7817 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
7820 @item @emph{Return value}:
7821 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
7822 after cross-promotion of the arguments.
7824 @item @emph{Example}:
7827 LOGICAL :: T = .TRUE., F = .FALSE.
7829 DATA a / Z,'F' /, b / Z'3' /
7831 WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
7832 WRITE (*,*) XOR(a, b)
7836 @item @emph{See also}:
7837 F95 elemental function: @ref{IEOR}