3 Free Software Foundation, Inc.
4 This is part of the GFORTRAN manual.
5 For copying conditions, see the file gfortran.texi.
7 Permission is granted to copy, distribute and/or modify this document
8 under the terms of the GNU Free Documentation License, Version 1.2 or
9 any later version published by the Free Software Foundation; with the
10 Invariant Sections being ``GNU General Public License'' and ``Funding
11 Free Software'', the Front-Cover texts being (a) (see below), and with
12 the Back-Cover Texts being (b) (see below). A copy of the license is
13 included in the gfdl(7) man page.
16 Some basic guidelines for editing this document:
18 (1) The intrinsic procedures are to be listed in alphabetical order.
19 (2) The generic name is to be use.
20 (3) The specific names are included in the function index and in a
21 table at the end of the node (See ABS entry).
22 (4) Try to maintain the same style for each entry.
27 @node Intrinsic Procedures
28 @chapter Intrinsic Procedures
29 @cindex Intrinsic Procedures
31 This portion of the document is incomplete and undergoing massive expansion
32 and editing. All contributions and corrections are strongly encouraged.
35 * Introduction: Introduction
36 * @code{ABORT}: ABORT, Abort the program
37 * @code{ABS}: ABS, Absolute value
38 * @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
39 * @code{ACOS}: ACOS, Arc cosine function
40 * @code{ADJUSTL}: ADJUSTL, Left adjust a string
41 * @code{ADJUSTR}: ADJUSTR, Right adjust a string
42 * @code{AIMAG}: AIMAG, Imaginary part of complex number
43 * @code{AINT}: AINT, Truncate to a whole number
44 * @code{ALL}: ALL, Determine if all values are true
45 * @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
46 * @code{ANINT}: ANINT, Nearest whole number
47 * @code{ANY}: ANY, Determine if any values are true
48 * @code{ASIN}: ASIN, Arcsine function
49 * @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
50 * @code{ATAN}: ATAN, Arctangent function
51 * @code{ATAN2}: ATAN2, Arctangent function
52 * @code{BESJ0}: BESJ0, Bessel function of the first kind of order 0
53 * @code{BESJ1}: BESJ1, Bessel function of the first kind of order 1
54 * @code{BESJN}: BESJN, Bessel function of the first kind
55 * @code{BESY0}: BESY0, Bessel function of the second kind of order 0
56 * @code{BESY1}: BESY1, Bessel function of the second kind of order 1
57 * @code{BESYN}: BESYN, Bessel function of the second kind
58 * @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
59 * @code{BTEST}: BTEST, Bit test function
60 * @code{CEILING}: CEILING, Integer ceiling function
61 * @code{CHAR}: CHAR, Character conversion function
62 * @code{CMPLX}: CMPLX, Complex conversion function
63 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Command line argument count
64 * @code{CONJG}: CONJG, Complex conjugate function
65 * @code{COS}: COS, Cosine function
66 * @code{COSH}: COSH, Hyperbolic cosine function
67 * @code{COUNT}: COUNT, Count occurrences of .TRUE. in an array
68 * @code{CPU_TIME}: CPU_TIME, CPU time subroutine
69 * @code{CSHIFT}: CSHIFT, Circular array shift function
70 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
71 * @code{DBLE}: DBLE, Double precision conversion function
72 * @code{DCMPLX}: DCMPLX, Double complex conversion function
73 * @code{DFLOAT}: DFLOAT, Double precision conversion function
74 * @code{DIGITS}: DIGITS, Significant digits function
75 * @code{DIM}: DIM, Dim function
76 * @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
77 * @code{DPROD}: DPROD, Double product function
78 * @code{DREAL}: DREAL, Double real part function
79 * @code{DTIME}: DTIME, Execution time subroutine (or function)
80 * @code{EOSHIFT}: EOSHIFT, End-off shift function
81 * @code{EPSILON}: EPSILON, Epsilon function
82 * @code{ERF}: ERF, Error function
83 * @code{ERFC}: ERFC, Complementary error function
84 * @code{ETIME}: ETIME, Execution time subroutine (or function)
85 * @code{EXIT}: EXIT, Exit the program with status.
86 * @code{EXP}: EXP, Exponential function
87 * @code{EXPONENT}: EXPONENT, Exponent function
88 * @code{FLOOR}: FLOOR, Integer floor function
89 * @code{FNUM}: FNUM, File number function
90 * @code{LOG}: LOG, Logarithm function
91 * @code{LOG10}: LOG10, Base 10 logarithm function
92 * @code{REAL}: REAL, Convert to real type
93 * @code{SQRT}: SQRT, Square-root function
94 * @code{SIN}: SIN, Sine function
95 * @code{SINH}: SINH, Hyperbolic sine function
96 * @code{TAN}: TAN, Tangent function
97 * @code{TANH}: TANH, Hyperbolic tangent function
101 @section Introduction to intrinsic procedures
103 Gfortran provides a rich set of intrinsic procedures that includes all
104 the intrinsic procedures required by the Fortran 95 standard, a set of
105 intrinsic procedures for backwards compatibility with Gnu Fortran 77
106 (i.e., @command{g77}), and a small selection of intrinsic procedures
107 from the Fortran 2003 standard. Any description here, which conflicts with a
108 description in either the Fortran 95 standard or the Fortran 2003 standard,
109 is unintentional and the standard(s) should be considered authoritative.
111 The enumeration of the @code{KIND} type parameter is processor defined in
112 the Fortran 95 standard. Gfortran defines the default integer type and
113 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
114 respectively. The standard mandates that both data types shall have
115 another kind, which have more precision. On typical target architectures
116 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
117 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
118 In the description of generic intrinsic procedures, the kind type parameter
119 will be specified by @code{KIND=*}, and in the description of specific
120 names for an intrinsic procedure the kind type parameter will be explicitly
121 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
122 brevity the optional @code{KIND=} syntax will be omitted.
124 Many of the intrinsics procedures take one or more optional arguments.
125 This document follows the convention used in the Fortran 95 standard,
126 and denotes such arguments by square brackets.
128 @command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
129 which can be used to restrict the set of intrinsic procedures to a
130 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
131 option, and so all intrinsic procedures described here are accepted. There
132 is one caveat. For a select group of intrinsic procedures, @command{g77}
133 implemented both a function and a subroutine. Both classes
134 have been implemented in @command{gfortran} for backwards compatibility
135 with @command{g77}. It is noted here that these functions and subroutines
136 cannot be intermixed in a given subprogram. In the descriptions that follow,
137 the applicable option(s) is noted.
142 @section @code{ABORT} --- Abort the program
147 @item @emph{Description}:
148 @code{ABORT} causes immediate termination of the program. On operating
149 systems that support a core dump, @code{ABORT} will produce a core dump,
150 which is suitable for debugging purposes.
156 non-elemental subroutine
161 @item @emph{Return value}:
164 @item @emph{Example}:
167 integer :: i = 1, j = 2
168 if (i /= j) call abort
169 end program test_abort
176 @section @code{ABS} --- Absolute value
177 @findex @code{ABS} intrinsic
178 @findex @code{CABS} intrinsic
179 @findex @code{DABS} intrinsic
180 @findex @code{IABS} intrinsic
181 @findex @code{ZABS} intrinsic
182 @findex @code{CDABS} intrinsic
183 @cindex absolute value
186 @item @emph{Description}:
187 @code{ABS(X)} computes the absolute value of @code{X}.
198 @item @emph{Arguments}:
199 @multitable @columnfractions .15 .80
200 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
201 @code{REAL(*)}, or @code{COMPLEX(*)}.
204 @item @emph{Return value}:
205 The return value is of the same type and
206 kind as the argument except the return value is @code{REAL(*)} for a
207 @code{COMPLEX(*)} argument.
209 @item @emph{Example}:
214 complex :: z = (-1.e0,0.e0)
221 @item @emph{Specific names}:
222 @multitable @columnfractions .24 .24 .24 .24
223 @item Name @tab Argument @tab Return type @tab Option
224 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab f95, gnu
225 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
226 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu
227 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
228 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
235 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
236 @findex @code{ACHAR} intrinsic
237 @cindex @acronym{ASCII} collating sequence
240 @item @emph{Description}:
241 @code{ACHAR(I)} returns the character located at position @code{I}
242 in the @acronym{ASCII} collating sequence.
253 @item @emph{Arguments}:
254 @multitable @columnfractions .15 .80
255 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
258 @item @emph{Return value}:
259 The return value is of type @code{CHARACTER} with a length of one. The
260 kind type parameter is the same as @code{KIND('A')}.
262 @item @emph{Example}:
267 end program test_achar
274 @section @code{ACOS} --- Arc cosine function
275 @findex @code{ACOS} intrinsic
276 @findex @code{DACOS} intrinsic
280 @item @emph{Description}:
281 @code{ACOS(X)} computes the arc cosine of @var{X}.
292 @item @emph{Arguments}:
293 @multitable @columnfractions .15 .80
294 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
298 @item @emph{Return value}:
299 The return value is of type @code{REAL(*)} and it lies in the
300 range @math{ 0 \leq \arccos (x) \leq \pi}. The kind type
301 parameter is the same as @var{X}.
303 @item @emph{Example}:
306 real(8) :: x = 0.866_8
308 end program test_acos
311 @item @emph{Specific names}:
312 @multitable @columnfractions .24 .24 .24 .24
313 @item Name @tab Argument @tab Return type @tab Option
314 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
321 @section @code{ADJUSTL} --- Left adjust a string
322 @findex @code{ADJUSTL} intrinsic
323 @cindex adjust string
326 @item @emph{Description}:
327 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
328 Spaces are inserted at the end of the string as needed.
337 @code{STR = ADJUSTL(STR)}
339 @item @emph{Arguments}:
340 @multitable @columnfractions .15 .80
341 @item @var{STR} @tab The type shall be @code{CHARACTER}.
344 @item @emph{Return value}:
345 The return value is of type @code{CHARACTER} where leading spaces
346 are removed and the same number of spaces are inserted on the end
349 @item @emph{Example}:
352 character(len=20) :: str = ' gfortran'
355 end program test_adjustl
362 @section @code{ADJUSTR} --- Right adjust a string
363 @findex @code{ADJUSTR} intrinsic
364 @cindex adjust string
367 @item @emph{Description}:
368 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
369 Spaces are inserted at the start of the string as needed.
378 @code{STR = ADJUSTR(STR)}
380 @item @emph{Arguments}:
381 @multitable @columnfractions .15 .80
382 @item @var{STR} @tab The type shall be @code{CHARACTER}.
385 @item @emph{Return value}:
386 The return value is of type @code{CHARACTER} where trailing spaces
387 are removed and the same number of spaces are inserted at the start
390 @item @emph{Example}:
393 character(len=20) :: str = 'gfortran'
396 end program test_adjustr
403 @section @code{AIMAG} --- Imaginary part of complex number
404 @findex @code{AIMAG} intrinsic
405 @findex @code{DIMAG} intrinsic
406 @findex @code{IMAG} intrinsic
407 @findex @code{IMAGPART} intrinsic
408 @cindex Imaginary part
411 @item @emph{Description}:
412 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
413 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
414 for compatibility with @command{g77}, and their use in new code is
415 strongly discouraged.
426 @item @emph{Arguments}:
427 @multitable @columnfractions .15 .80
428 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
431 @item @emph{Return value}:
432 The return value is of type real with the
433 kind type parameter of the argument.
435 @item @emph{Example}:
440 z4 = cmplx(1.e0_4, 0.e0_4)
441 z8 = cmplx(0.e0_8, 1.e0_8)
442 print *, aimag(z4), dimag(z8)
443 end program test_aimag
446 @item @emph{Specific names}:
447 @multitable @columnfractions .24 .24 .24 .24
448 @item Name @tab Argument @tab Return type @tab Option
449 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab f95, gnu
450 @item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab gnu
451 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab gnu
458 @section @code{AINT} --- Imaginary part of complex number
459 @findex @code{AINT} intrinsic
460 @findex @code{DINT} intrinsic
464 @item @emph{Description}:
465 @code{AINT(X [, KIND])} truncates its argument to a whole number.
475 @code{X = AINT(X, KIND)}
477 @item @emph{Arguments}:
478 @multitable @columnfractions .15 .80
479 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
480 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
481 initialization expression.
484 @item @emph{Return value}:
485 The return value is of type real with the kind type parameter of the
486 argument if the optional @var{KIND} is absent; otherwise, the kind
487 type parameter will be given by @var{KIND}. If the magnitude of
488 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
489 magnitude is equal to or greater than one, then it returns the largest
490 whole number that does not exceed its magnitude. The sign is the same
491 as the sign of @var{X}.
493 @item @emph{Example}:
500 print *, aint(x4), dint(x8)
502 end program test_aint
505 @item @emph{Specific names}:
506 @multitable @columnfractions .24 .24 .24 .24
507 @item Name @tab Argument @tab Return type @tab Option
508 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
515 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
516 @findex @code{ALL} intrinsic
520 @item @emph{Description}:
521 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
522 in the array along dimension @var{DIM}.
528 transformational function
532 @code{L = ALL(MASK, DIM)}
534 @item @emph{Arguments}:
535 @multitable @columnfractions .15 .80
536 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
537 it shall not be scalar.
538 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
539 with a value that lies between one and the rank of @var{MASK}.
542 @item @emph{Return value}:
543 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
544 the kind type parameter is the same as the kind type parameter of
545 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
546 an array with the rank of @var{MASK} minus 1. The shape is determined from
547 the shape of @var{MASK} where the @var{DIM} dimension is elided.
551 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
552 It also is true if @var{MASK} has zero size; otherwise, it is false.
554 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
555 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
556 is determined by applying @code{ALL} to the array sections.
559 @item @emph{Example}:
563 l = all((/.true., .true., .true./))
568 integer a(2,3), b(2,3)
572 print *, all(a .eq. b, 1)
573 print *, all(a .eq. b, 2)
574 end subroutine section
582 @section @code{ALLOCATED} --- Status of an allocatable entity
583 @findex @code{ALLOCATED} intrinsic
584 @cindex allocation status
587 @item @emph{Description}:
588 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
597 @code{L = ALLOCATED(X)}
599 @item @emph{Arguments}:
600 @multitable @columnfractions .15 .80
601 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
604 @item @emph{Return value}:
605 The return value is a scalar @code{LOGICAL} with the default logical
606 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
607 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
609 @item @emph{Example}:
611 program test_allocated
613 real(4), allocatable :: x(:)
614 if (allocated(x) .eqv. .false.) allocate(x(i)
615 end program test_allocated
622 @section @code{ANINT} --- Imaginary part of complex number
623 @findex @code{ANINT} intrinsic
624 @findex @code{DNINT} intrinsic
628 @item @emph{Description}:
629 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
639 @code{X = ANINT(X, KIND)}
641 @item @emph{Arguments}:
642 @multitable @columnfractions .15 .80
643 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
644 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
645 initialization expression.
648 @item @emph{Return value}:
649 The return value is of type real with the kind type parameter of the
650 argument if the optional @var{KIND} is absent; otherwise, the kind
651 type parameter will be given by @var{KIND}. If @var{X} is greater than
652 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
653 less than or equal to zero, then return @code{AINT(X-0.5)}.
655 @item @emph{Example}:
662 print *, anint(x4), dnint(x8)
664 end program test_anint
667 @item @emph{Specific names}:
668 @multitable @columnfractions .24 .24 .24 .24
669 @item Name @tab Argument @tab Return type @tab Option
670 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
677 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
678 @findex @code{ANY} intrinsic
682 @item @emph{Description}:
683 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
684 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
690 transformational function
694 @code{L = ANY(MASK, DIM)}
696 @item @emph{Arguments}:
697 @multitable @columnfractions .15 .80
698 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
699 it shall not be scalar.
700 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
701 with a value that lies between one and the rank of @var{MASK}.
704 @item @emph{Return value}:
705 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
706 the kind type parameter is the same as the kind type parameter of
707 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
708 an array with the rank of @var{MASK} minus 1. The shape is determined from
709 the shape of @var{MASK} where the @var{DIM} dimension is elided.
713 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
714 otherwise, it is false. It also is false if @var{MASK} has zero size.
716 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
717 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
718 is determined by applying @code{ANY} to the array sections.
721 @item @emph{Example}:
725 l = any((/.true., .true., .true./))
730 integer a(2,3), b(2,3)
734 print *, any(a .eq. b, 1)
735 print *, any(a .eq. b, 2)
736 end subroutine section
744 @section @code{ASIN} --- Arcsine function
745 @findex @code{ASIN} intrinsic
746 @findex @code{DASIN} intrinsic
750 @item @emph{Description}:
751 @code{ASIN(X)} computes the arcsine of its @var{X}.
762 @item @emph{Arguments}:
763 @multitable @columnfractions .15 .80
764 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
768 @item @emph{Return value}:
769 The return value is of type @code{REAL(*)} and it lies in the
770 range @math{-\pi / 2 \leq \arccos (x) \leq \pi / 2}. The kind type
771 parameter is the same as @var{X}.
773 @item @emph{Example}:
776 real(8) :: x = 0.866_8
778 end program test_asin
781 @item @emph{Specific names}:
782 @multitable @columnfractions .24 .24 .24 .24
783 @item Name @tab Argument @tab Return type @tab Option
784 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
791 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
792 @findex @code{ASSOCIATED} intrinsic
793 @cindex pointer status
796 @item @emph{Description}:
797 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
798 or if @var{PTR} is associated with the target @var{TGT}.
807 @code{L = ASSOCIATED(PTR)}
808 @code{L = ASSOCIATED(PTR [, TGT])}
810 @item @emph{Arguments}:
811 @multitable @columnfractions .15 .80
812 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
813 it can be of any type.
814 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
815 a @code{TARGET}. It must have the same type, kind type parameter, and
816 array rank as @var{PTR}.
818 The status of neither @var{PTR} nor @var{TGT} can be undefined.
820 @item @emph{Return value}:
821 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
822 There are several cases:
824 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
825 is true if @var{PTR} is associated with a target; otherwise, it returns false.
826 @item (B) If @var{TGT} is present and a scalar target, the result is true if
828 is not a 0 sized storage sequence and the target associated with @var{PTR}
829 occupies the same storage units. If @var{PTR} is disassociated, then the
831 @item (C) If @var{TGT} is present and an array target, the result is true if
832 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
833 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
834 @var{PTR} occupy the same storage units in array element order.
835 As in case(B), the result is false, if @var{PTR} is disassociated.
836 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
837 target associated with @var{PTR} and the target associated with @var{TGT}
838 are not 0 sized storage sequences and occupy the same storage units.
839 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
840 @item (E) If @var{TGT} is present and an array pointer, the result is true if
841 target associated with @var{PTR} and the target associated with @var{TGT}
842 have the same shape, are not 0 sized arrays, are arrays whose elements are
843 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
844 storage units in array element order.
845 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
848 @item @emph{Example}:
850 program test_associated
852 real, target :: tgt(2) = (/1., 2./)
853 real, pointer :: ptr(:)
855 if (associated(ptr) .eqv. .false.) call abort
856 if (associated(ptr,tgt) .eqv. .false.) call abort
857 end program test_associated
864 @section @code{ATAN} --- Arctangent function
865 @findex @code{ATAN} intrinsic
866 @findex @code{DATAN} intrinsic
870 @item @emph{Description}:
871 @code{ATAN(X)} computes the arctangent of @var{X}.
882 @item @emph{Arguments}:
883 @multitable @columnfractions .15 .80
884 @item @var{X} @tab The type shall be @code{REAL(*)}.
887 @item @emph{Return value}:
888 The return value is of type @code{REAL(*)} and it lies in the
889 range @math{ - \pi / 2 \leq \arcsin (x) \leq \pi / 2}.
891 @item @emph{Example}:
894 real(8) :: x = 2.866_8
896 end program test_atan
899 @item @emph{Specific names}:
900 @multitable @columnfractions .24 .24 .24 .24
901 @item Name @tab Argument @tab Return type @tab Option
902 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
909 @section @code{ATAN2} --- Arctangent function
910 @findex @code{ATAN2} intrinsic
911 @findex @code{DATAN2} intrinsic
915 @item @emph{Description}:
916 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
925 @code{X = ATAN2(Y,X)}
927 @item @emph{Arguments}:
928 @multitable @columnfractions .15 .80
929 @item @var{Y} @tab The type shall be @code{REAL(*)}.
930 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
931 If @var{Y} is zero, then @var{X} must be nonzero.
934 @item @emph{Return value}:
935 The return value has the same type and kind type parameter as @var{Y}.
936 It is the principle value of the complex number @math{X + i Y}. If
937 @var{X} is nonzero, then it lies in the range @math{-\pi \le \arccos (x) \leq \pi}.
938 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
939 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
940 is negative. Finally, if @var{X} is zero, then the magnitude of the result
943 @item @emph{Example}:
946 real(4) :: x = 1.e0_4, y = 0.5e0_4
948 end program test_atan2
951 @item @emph{Specific names}:
952 @multitable @columnfractions .24 .24 .24 .24
953 @item Name @tab Argument @tab Return type @tab Option
954 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
961 @section @code{BESJ0} --- Bessel function of the first kind of order 0
962 @findex @code{BESJ0} intrinsic
963 @findex @code{DBESJ0} intrinsic
967 @item @emph{Description}:
968 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
980 @item @emph{Arguments}:
981 @multitable @columnfractions .15 .80
982 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
985 @item @emph{Return value}:
986 The return value is of type @code{REAL(*)} and it lies in the
987 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
989 @item @emph{Example}:
994 end program test_besj0
997 @item @emph{Specific names}:
998 @multitable @columnfractions .24 .24 .24 .24
999 @item Name @tab Argument @tab Return type @tab Option
1000 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1007 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1008 @findex @code{BESJ1} intrinsic
1009 @findex @code{DBESJ1} intrinsic
1013 @item @emph{Description}:
1014 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1017 @item @emph{Option}:
1023 @item @emph{Syntax}:
1026 @item @emph{Arguments}:
1027 @multitable @columnfractions .15 .80
1028 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1031 @item @emph{Return value}:
1032 The return value is of type @code{REAL(*)} and it lies in the
1033 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1035 @item @emph{Example}:
1038 real(8) :: x = 1.0_8
1040 end program test_besj1
1043 @item @emph{Specific names}:
1044 @multitable @columnfractions .24 .24 .24 .24
1045 @item Name @tab Argument @tab Return type @tab Option
1046 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1053 @section @code{BESJN} --- Bessel function of the first kind
1054 @findex @code{BESJN} intrinsic
1055 @findex @code{DBESJN} intrinsic
1059 @item @emph{Description}:
1060 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1063 @item @emph{Option}:
1069 @item @emph{Syntax}:
1070 @code{Y = BESJN(N, X)}
1072 @item @emph{Arguments}:
1073 @multitable @columnfractions .15 .80
1074 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1075 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1078 @item @emph{Return value}:
1079 The return value is a scalar of type @code{REAL(*)}.
1081 @item @emph{Example}:
1084 real(8) :: x = 1.0_8
1086 end program test_besjn
1089 @item @emph{Specific names}:
1090 @multitable @columnfractions .24 .24 .24 .24
1091 @item Name @tab Argument @tab Return type @tab Option
1092 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1093 @item @tab @code{REAL(8) X} @tab @tab
1100 @section @code{BESY0} --- Bessel function of the second kind of order 0
1101 @findex @code{BESY0} intrinsic
1102 @findex @code{DBESY0} intrinsic
1106 @item @emph{Description}:
1107 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1110 @item @emph{Option}:
1116 @item @emph{Syntax}:
1119 @item @emph{Arguments}:
1120 @multitable @columnfractions .15 .80
1121 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1124 @item @emph{Return value}:
1125 The return value is a scalar of type @code{REAL(*)}.
1127 @item @emph{Example}:
1130 real(8) :: x = 0.0_8
1132 end program test_besy0
1135 @item @emph{Specific names}:
1136 @multitable @columnfractions .24 .24 .24 .24
1137 @item Name @tab Argument @tab Return type @tab Option
1138 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1145 @section @code{BESY1} --- Bessel function of the second kind of order 1
1146 @findex @code{BESY1} intrinsic
1147 @findex @code{DBESY1} intrinsic
1151 @item @emph{Description}:
1152 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1155 @item @emph{Option}:
1161 @item @emph{Syntax}:
1164 @item @emph{Arguments}:
1165 @multitable @columnfractions .15 .80
1166 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1169 @item @emph{Return value}:
1170 The return value is a scalar of type @code{REAL(*)}.
1172 @item @emph{Example}:
1175 real(8) :: x = 1.0_8
1177 end program test_besy1
1180 @item @emph{Specific names}:
1181 @multitable @columnfractions .24 .24 .24 .24
1182 @item Name @tab Argument @tab Return type @tab Option
1183 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1190 @section @code{BESYN} --- Bessel function of the second kind
1191 @findex @code{BESYN} intrinsic
1192 @findex @code{DBESYN} intrinsic
1196 @item @emph{Description}:
1197 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1200 @item @emph{Option}:
1206 @item @emph{Syntax}:
1207 @code{Y = BESYN(N, X)}
1209 @item @emph{Arguments}:
1210 @multitable @columnfractions .15 .80
1211 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1212 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1215 @item @emph{Return value}:
1216 The return value is a scalar of type @code{REAL(*)}.
1218 @item @emph{Example}:
1221 real(8) :: x = 1.0_8
1223 end program test_besyn
1226 @item @emph{Specific names}:
1227 @multitable @columnfractions .24 .24 .24 .24
1228 @item Name @tab Argument @tab Return type @tab Option
1229 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1230 @item @tab @code{REAL(8) X} @tab @tab
1237 @section @code{BIT_SIZE} --- Bit size inquiry function
1238 @findex @code{BIT_SIZE} intrinsic
1242 @item @emph{Description}:
1243 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1244 represented by the type of @var{I}.
1246 @item @emph{Option}:
1252 @item @emph{Syntax}:
1253 @code{I = BIT_SIZE(I)}
1255 @item @emph{Arguments}:
1256 @multitable @columnfractions .15 .80
1257 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1260 @item @emph{Return value}:
1261 The return value is of type @code{INTEGER(*)}
1263 @item @emph{Example}:
1265 program test_bit_size
1270 end program test_bit_size
1277 @section @code{BTEST} --- Bit test function
1278 @findex @code{BTEST} intrinsic
1282 @item @emph{Description}:
1283 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1286 @item @emph{Option}:
1292 @item @emph{Syntax}:
1293 @code{I = BTEST(I,POS)}
1295 @item @emph{Arguments}:
1296 @multitable @columnfractions .15 .80
1297 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1298 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1301 @item @emph{Return value}:
1302 The return value is of type @code{LOGICAL}
1304 @item @emph{Example}:
1307 integer :: i = 32768 + 1024 + 64
1311 bool = btest(i, pos)
1314 end program test_btest
1321 @section @code{CEILING} --- Integer ceiling function
1322 @findex @code{CEILING} intrinsic
1326 @item @emph{Description}:
1327 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1329 @item @emph{Option}:
1335 @item @emph{Syntax}:
1336 @code{I = CEILING(X[,KIND])}
1338 @item @emph{Arguments}:
1339 @multitable @columnfractions .15 .80
1340 @item @var{X} @tab The type shall be @code{REAL(*)}.
1341 @item @var{KIND} @tab Optional scaler integer initialization expression.
1344 @item @emph{Return value}:
1345 The return value is of type @code{INTEGER(KIND)}
1347 @item @emph{Example}:
1349 program test_ceiling
1352 print *, ceiling(x) ! returns 64
1353 print *, ceiling(y) ! returns -63
1354 end program test_ceiling
1361 @section @code{CHAR} --- Character conversion function
1362 @findex @code{CHAR} intrinsic
1366 @item @emph{Description}:
1367 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1369 @item @emph{Option}:
1375 @item @emph{Syntax}:
1376 @code{C = CHAR(I[,KIND])}
1378 @item @emph{Arguments}:
1379 @multitable @columnfractions .15 .80
1380 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1381 @item @var{KIND} @tab Optional scaler integer initialization expression.
1384 @item @emph{Return value}:
1385 The return value is of type @code{CHARACTER(1)}
1387 @item @emph{Example}:
1393 print *, i, c ! returns 'J'
1394 end program test_char
1401 @section @code{CMPLX} --- Complex conversion function
1402 @findex @code{CMPLX} intrinsic
1406 @item @emph{Description}:
1407 @code{CMPLX(X,[Y,KIND])} returns a complex number where @var{X} is converted to
1408 the real component. If @var{Y} is present it is converted to the imaginary
1409 component. If @var{Y} is not present then the imaginary component is set to
1410 0.0. If @var{X} is complex then @var{Y} must not be present.
1412 @item @emph{Option}:
1418 @item @emph{Syntax}:
1419 @code{C = CMPLX(X[,Y,KIND])}
1421 @item @emph{Arguments}:
1422 @multitable @columnfractions .15 .80
1423 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1424 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1425 @item @var{KIND} @tab Optional scaler integer initialization expression.
1428 @item @emph{Return value}:
1429 The return value is of type @code{COMPLEX(*)}
1431 @item @emph{Example}:
1438 print *, z, cmplx(x)
1439 end program test_cmplx
1445 @node COMMAND_ARGUMENT_COUNT
1446 @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function
1447 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1448 @cindex command argument count
1451 @item @emph{Description}:
1452 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1453 command line when the containing program was invoked.
1455 @item @emph{Option}:
1459 non-elemental function
1461 @item @emph{Syntax}:
1462 @code{I = COMMAND_ARGUMENT_COUNT()}
1464 @item @emph{Arguments}:
1465 @multitable @columnfractions .15 .80
1469 @item @emph{Return value}:
1470 The return value is of type @code{INTEGER(4)}
1472 @item @emph{Example}:
1474 program test_command_argument_count
1476 count = command_argument_count()
1478 end program test_command_argument_count
1485 @section @code{CONJG} --- Complex conjugate function
1486 @findex @code{CONJG} intrinsic
1487 @findex @code{DCONJG} intrinsic
1488 @cindex complex conjugate
1490 @item @emph{Description}:
1491 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
1492 then the result is @code{(x, -y)}
1494 @item @emph{Option}:
1500 @item @emph{Syntax}:
1503 @item @emph{Arguments}:
1504 @multitable @columnfractions .15 .80
1505 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
1508 @item @emph{Return value}:
1509 The return value is of type @code{COMPLEX(*)}.
1511 @item @emph{Example}:
1514 complex :: z = (2.0, 3.0)
1515 complex(8) :: dz = (2.71_8, -3.14_8)
1520 end program test_conjg
1523 @item @emph{Specific names}:
1524 @multitable @columnfractions .24 .24 .24 .24
1525 @item Name @tab Argument @tab Return type @tab Option
1526 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
1533 @section @code{COS} --- Cosine function
1534 @findex @code{COS} intrinsic
1535 @findex @code{DCOS} intrinsic
1536 @findex @code{ZCOS} intrinsic
1537 @findex @code{CDCOS} intrinsic
1541 @item @emph{Description}:
1542 @code{COS(X)} computes the cosine of @var{X}.
1544 @item @emph{Option}:
1550 @item @emph{Syntax}:
1553 @item @emph{Arguments}:
1554 @multitable @columnfractions .15 .80
1555 @item @var{X} @tab The type shall be @code{REAL(*)} or
1559 @item @emph{Return value}:
1560 The return value has the same type and kind as @var{X}.
1562 @item @emph{Example}:
1567 end program test_cos
1570 @item @emph{Specific names}:
1571 @multitable @columnfractions .24 .24 .24 .24
1572 @item Name @tab Argument @tab Return type @tab Option
1573 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1574 @item @code{CCOS(X)}@tab @code{COMPLEX(4) X}@tab @code{COMPLEX(4)}@tab f95, gnu
1575 @item @code{ZCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1576 @item @code{CDCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1583 @section @code{COSH} --- Hyperbolic cosine function
1584 @findex @code{COSH} intrinsic
1585 @findex @code{DCOSH} intrinsic
1586 @cindex hyperbolic cosine
1589 @item @emph{Description}:
1590 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
1592 @item @emph{Option}:
1598 @item @emph{Syntax}:
1601 @item @emph{Arguments}:
1602 @multitable @columnfractions .15 .80
1603 @item @var{X} @tab The type shall be @code{REAL(*)}.
1606 @item @emph{Return value}:
1607 The return value is of type @code{REAL(*)} and it is positive
1608 (@math{ \cosh (x) \geq 0 }.
1610 @item @emph{Example}:
1613 real(8) :: x = 1.0_8
1615 end program test_cosh
1618 @item @emph{Specific names}:
1619 @multitable @columnfractions .24 .24 .24 .24
1620 @item Name @tab Argument @tab Return type @tab Option
1621 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1628 @section @code{COUNT} --- Count function
1629 @findex @code{COUNT} intrinsic
1633 @item @emph{Description}:
1634 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
1635 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
1636 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
1637 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
1639 @item @emph{Option}:
1643 transformational function
1645 @item @emph{Syntax}:
1646 @code{I = COUNT(MASK[,DIM])}
1648 @item @emph{Arguments}:
1649 @multitable @columnfractions .15 .80
1650 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
1651 @item @var{DIM} @tab The type shall be @code{INTEGER}.
1654 @item @emph{Return value}:
1655 The return value is of type @code{INTEGER} with rank equal to that of
1658 @item @emph{Example}:
1661 integer, dimension(2,3) :: a, b
1662 logical, dimension(2,3) :: mask
1663 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
1664 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
1665 print '(3i3)', a(1,:)
1666 print '(3i3)', a(2,:)
1668 print '(3i3)', b(1,:)
1669 print '(3i3)', b(2,:)
1672 print '(3l3)', mask(1,:)
1673 print '(3l3)', mask(2,:)
1675 print '(3i3)', count(mask)
1677 print '(3i3)', count(mask, 1)
1679 print '(3i3)', count(mask, 2)
1680 end program test_count
1687 @section @code{CPU_TIME} --- CPU elapsed time in seconds
1688 @findex @code{CPU_TIME} intrinsic
1692 @item @emph{Description}:
1693 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
1694 is useful for testing segments of code to determine execution time.
1696 @item @emph{Option}:
1702 @item @emph{Syntax}:
1705 @item @emph{Arguments}:
1706 @multitable @columnfractions .15 .80
1707 @item @var{X} @tab The type shall be @code{REAL} with intent out.
1710 @item @emph{Return value}:
1713 @item @emph{Example}:
1715 program test_cpu_time
1716 real :: start, finish
1717 call cpu_time(start)
1718 ! put code to test here
1719 call cpu_time(finish)
1720 print '("Time = ",f6.3," seconds.")',finish-start
1721 end program test_cpu_time
1728 @section @code{CSHIFT} --- Circular shift function
1729 @findex @code{CSHIFT} intrinsic
1730 @cindex cshift intrinsic
1733 @item @emph{Description}:
1734 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
1735 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
1736 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
1737 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
1738 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
1739 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
1740 sections of @var{ARRAY} along the given dimension are shifted. Elements
1741 shifted out one end of each rank one section are shifted back in the other end.
1743 @item @emph{Option}:
1747 transformational function
1749 @item @emph{Syntax}:
1750 @code{A = CSHIFT(A, SHIFT[,DIM])}
1752 @item @emph{Arguments}:
1753 @multitable @columnfractions .15 .80
1754 @item @var{ARRAY} @tab May be any type, not scaler.
1755 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
1756 @item @var{DIM} @tab The type shall be @code{INTEGER}.
1759 @item @emph{Return value}:
1760 Returns an array of same type and rank as the @var{ARRAY} argument.
1762 @item @emph{Example}:
1765 integer, dimension(3,3) :: a
1766 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
1767 print '(3i3)', a(1,:)
1768 print '(3i3)', a(2,:)
1769 print '(3i3)', a(3,:)
1770 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
1772 print '(3i3)', a(1,:)
1773 print '(3i3)', a(2,:)
1774 print '(3i3)', a(3,:)
1775 end program test_cshift
1782 @section @code{DATE_AND_TIME} --- Date and time subroutine
1783 @findex @code{DATE_AND_TIME} intrinsic
1784 @cindex DATE_AND_TIME
1787 @item @emph{Description}:
1788 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
1789 time information from the real-time system clock. @var{DATE} is
1790 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
1791 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
1792 representing the difference with respect to Coordinated Universal Time (UTC).
1793 Unavailable time and date parameters return blanks.
1795 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
1797 @multitable @columnfractions .15 .30 .60
1798 @item @tab @code{VALUE(1)}: @tab The year
1799 @item @tab @code{VALUE(2)}: @tab The month
1800 @item @tab @code{VALUE(3)}: @tab The day of the month
1801 @item @tab @code{VAlUE(4)}: @tab Time difference with UTC in minutes
1802 @item @tab @code{VALUE(5)}: @tab The hour of the day
1803 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
1804 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
1805 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
1808 @item @emph{Option}:
1814 @item @emph{Syntax}:
1815 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
1817 @item @emph{Arguments}:
1818 @multitable @columnfractions .15 .80
1819 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
1820 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
1821 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
1822 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
1825 @item @emph{Return value}:
1828 @item @emph{Example}:
1830 program test_time_and_date
1831 character(8) :: date
1832 character(10) :: time
1833 character(5) :: zone
1834 integer,dimension(8) :: values
1835 ! using keyword arguments
1836 call date_and_time(date,time,zone,values)
1837 call date_and_time(DATE=date,ZONE=zone)
1838 call date_and_time(TIME=time)
1839 call date_and_time(VALUES=values)
1840 print '(a,2x,a,2x,a)', date, time, zone
1841 print '(8i5))', values
1842 end program test_time_and_date
1849 @section @code{DBLE} --- Double conversion function
1850 @findex @code{DBLE} intrinsic
1851 @cindex double conversion
1854 @item @emph{Description}:
1855 @code{DBLE(X)} Converts @var{X} to double precision real type.
1856 @code{DFLOAT} is an alias for @code{DBLE}
1858 @item @emph{Option}:
1864 @item @emph{Syntax}:
1866 @code{X = DFLOAT(X)}
1868 @item @emph{Arguments}:
1869 @multitable @columnfractions .15 .80
1870 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1873 @item @emph{Return value}:
1874 The return value is of type double precision real.
1876 @item @emph{Example}:
1881 complex :: z = (2.3,1.14)
1882 print *, dble(x), dble(i), dfloat(z)
1883 end program test_dble
1890 @section @code{DCMPLX} --- Double complex conversion function
1891 @findex @code{DCMPLX} intrinsic
1895 @item @emph{Description}:
1896 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
1897 converted to the real component. If @var{Y} is present it is converted to the
1898 imaginary component. If @var{Y} is not present then the imaginary component is
1899 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
1901 @item @emph{Option}:
1907 @item @emph{Syntax}:
1908 @code{C = DCMPLX(X)}
1909 @code{C = DCMPLX(X,Y)}
1911 @item @emph{Arguments}:
1912 @multitable @columnfractions .15 .80
1913 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1914 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1917 @item @emph{Return value}:
1918 The return value is of type @code{COMPLEX(8)}
1920 @item @emph{Example}:
1930 print *, dcmplx(x,i)
1931 end program test_dcmplx
1938 @section @code{DFLOAT} --- Double conversion function
1939 @findex @code{DFLOAT} intrinsic
1940 @cindex double float conversion
1943 @item @emph{Description}:
1944 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
1945 @code{DFLOAT} is an alias for @code{DBLE}. See @code{DBLE}.
1951 @section @code{DIGITS} --- Significant digits function
1952 @findex @code{DIGITS} intrinsic
1953 @cindex digits, significant
1956 @item @emph{Description}:
1957 @code{DIGITS(X)} returns the number of significant digits of the internal model
1958 representation of @var{X}. For example, on a system using a 32-bit
1959 floating point representation, a default real number would likely return 24.
1961 @item @emph{Option}:
1967 @item @emph{Syntax}:
1968 @code{C = DIGITS(X)}
1970 @item @emph{Arguments}:
1971 @multitable @columnfractions .15 .80
1972 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
1975 @item @emph{Return value}:
1976 The return value is of type @code{INTEGER}.
1978 @item @emph{Example}:
1981 integer :: i = 12345
1987 end program test_digits
1994 @section @code{DIM} --- Dim function
1995 @findex @code{DIM} intrinsic
1996 @findex @code{IDIM} intrinsic
1997 @findex @code{DDIM} intrinsic
2001 @item @emph{Description}:
2002 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2003 otherwise returns zero.
2005 @item @emph{Option}:
2011 @item @emph{Syntax}:
2014 @item @emph{Arguments}:
2015 @multitable @columnfractions .15 .80
2016 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2017 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2020 @item @emph{Return value}:
2021 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2023 @item @emph{Example}:
2029 x = dim(4.345_8, 2.111_8)
2032 end program test_dim
2035 @item @emph{Specific names}:
2036 @multitable @columnfractions .24 .24 .24 .24
2037 @item Name @tab Argument @tab Return type @tab Option
2038 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab gnu
2039 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab gnu
2046 @section @code{DOT_PRODUCT} --- Dot product function
2047 @findex @code{DOT_PRODUCT} intrinsic
2051 @item @emph{Description}:
2052 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2053 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2054 and must be arrays of rank one and of equal size. If the vectors are
2055 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2056 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2057 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2059 @item @emph{Option}:
2063 transformational function
2065 @item @emph{Syntax}:
2066 @code{S = DOT_PRODUCT(X,Y)}
2068 @item @emph{Arguments}:
2069 @multitable @columnfractions .15 .80
2070 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2071 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2074 @item @emph{Return value}:
2075 If the arguments are numeric, the return value is a scaler of numeric type,
2076 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2077 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2079 @item @emph{Example}:
2081 program test_dot_prod
2082 integer, dimension(3) :: a, b
2089 print *, dot_product(a,b)
2090 end program test_dot_prod
2097 @section @code{DPROD} --- Double product function
2098 @findex @code{DPROD} intrinsic
2099 @cindex Double product
2102 @item @emph{Description}:
2103 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2105 @item @emph{Option}:
2111 @item @emph{Syntax}:
2112 @code{D = DPROD(X,Y)}
2114 @item @emph{Arguments}:
2115 @multitable @columnfractions .15 .80
2116 @item @var{X} @tab The type shall be @code{REAL}.
2117 @item @var{Y} @tab The type shall be @code{REAL}.
2120 @item @emph{Return value}:
2121 The return value is of type @code{REAL(8)}.
2123 @item @emph{Example}:
2132 end program test_dprod
2139 @section @code{DREAL} --- Double real part function
2140 @findex @code{DREAL} intrinsic
2141 @cindex Double real part
2144 @item @emph{Description}:
2145 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2147 @item @emph{Option}:
2153 @item @emph{Syntax}:
2156 @item @emph{Arguments}:
2157 @multitable @columnfractions .15 .80
2158 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2161 @item @emph{Return value}:
2162 The return value is of type @code{REAL(8)}.
2164 @item @emph{Example}:
2167 complex(8) :: z = (1.3_8,7.2_8)
2169 end program test_dreal
2176 @section @code{DTIME} --- Execution time subroutine (or function)
2177 @findex @code{DTIME} intrinsic
2178 @cindex dtime subroutine
2181 @item @emph{Description}:
2182 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2183 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2184 returns the user and system components of this time in @code{TARRAY(1)} and
2185 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2188 Subsequent invocations of @code{DTIME} return values accumulated since the
2189 previous invocation.
2191 On some systems, the underlying timings are represented using types with
2192 sufficiently small limits that overflows (wraparounds) are possible, such as
2193 32-bit types. Therefore, the values returned by this intrinsic might be, or
2194 become, negative, or numerically less than previous values, during a single
2195 run of the compiled program.
2197 If @code{DTIME} is invoked as a function, it can not be invoked as a
2198 subroutine, and vice versa.
2200 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2202 @multitable @columnfractions .15 .30 .60
2203 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2204 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2205 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2208 @item @emph{Option}:
2214 @item @emph{Syntax}:
2215 @multitable @columnfractions .80
2216 @item @code{CALL DTIME(TARRAY, RESULT)}.
2217 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2220 @item @emph{Arguments}:
2221 @multitable @columnfractions .15 .80
2222 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2223 @item @var{RESULT}@tab The type shall be @code{REAL}.
2226 @item @emph{Return value}:
2227 Elapsed time in seconds since the start of program execution.
2229 @item @emph{Example}:
2233 real, dimension(2) :: tarray
2235 call dtime(tarray, result)
2239 do i=1,100000000 ! Just a delay
2242 call dtime(tarray, result)
2246 end program test_dtime
2253 @section @code{EOSHIFT} --- End-off shift function
2254 @findex @code{EOSHIFT} intrinsic
2255 @cindex eoshift intrinsic
2258 @item @emph{Description}:
2259 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2260 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2261 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2262 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2263 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2264 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2265 then all complete rank one sections of @var{ARRAY} along the given dimension are
2266 shifted. Elements shifted out one end of each rank one section are dropped. If
2267 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2268 is copied back in the other end. If @var{BOUNDARY} is not present then the
2269 following are copied in depending on the type of @var{ARRAY}.
2271 @multitable @columnfractions .15 .80
2272 @item @emph{Array Type} @tab @emph{Boundary Value}
2273 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2274 @item Logical @tab @code{.FALSE.}.
2275 @item Character(@var{len}) @tab @var{len} blanks.
2278 @item @emph{Option}:
2282 transformational function
2284 @item @emph{Syntax}:
2285 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2287 @item @emph{Arguments}:
2288 @multitable @columnfractions .15 .80
2289 @item @var{ARRAY} @tab May be any type, not scaler.
2290 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2291 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2292 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2295 @item @emph{Return value}:
2296 Returns an array of same type and rank as the @var{ARRAY} argument.
2298 @item @emph{Example}:
2300 program test_eoshift
2301 integer, dimension(3,3) :: a
2302 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2303 print '(3i3)', a(1,:)
2304 print '(3i3)', a(2,:)
2305 print '(3i3)', a(3,:)
2306 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2308 print '(3i3)', a(1,:)
2309 print '(3i3)', a(2,:)
2310 print '(3i3)', a(3,:)
2311 end program test_eoshift
2318 @section @code{EPSILON} --- Epsilon function
2319 @findex @code{EPSILON} intrinsic
2320 @cindex epsilon, significant
2323 @item @emph{Description}:
2324 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2326 @item @emph{Option}:
2332 @item @emph{Syntax}:
2333 @code{C = EPSILON(X)}
2335 @item @emph{Arguments}:
2336 @multitable @columnfractions .15 .80
2337 @item @var{X} @tab The type shall be @code{REAL(*)}.
2340 @item @emph{Return value}:
2341 The return value is of same type as the argument.
2343 @item @emph{Example}:
2345 program test_epsilon
2350 end program test_epsilon
2357 @section @code{ERF} --- Error function
2358 @findex @code{ERF} intrinsic
2359 @cindex error function
2362 @item @emph{Description}:
2363 @code{ERF(X)} computes the error function of @var{X}.
2365 @item @emph{Option}:
2371 @item @emph{Syntax}:
2374 @item @emph{Arguments}:
2375 @multitable @columnfractions .15 .80
2376 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2379 @item @emph{Return value}:
2380 The return value is a scalar of type @code{REAL(*)} and it is positive
2381 (@math{ - 1 \leq erf (x) \leq 1 }.
2383 @item @emph{Example}:
2386 real(8) :: x = 0.17_8
2388 end program test_erf
2391 @item @emph{Specific names}:
2392 @multitable @columnfractions .24 .24 .24 .24
2393 @item Name @tab Argument @tab Return type @tab Option
2394 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
2401 @section @code{ERFC} --- Error function
2402 @findex @code{ERFC} intrinsic
2403 @cindex error function
2406 @item @emph{Description}:
2407 @code{ERFC(X)} computes the complementary error function of @var{X}.
2409 @item @emph{Option}:
2415 @item @emph{Syntax}:
2418 @item @emph{Arguments}:
2419 @multitable @columnfractions .15 .80
2420 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2423 @item @emph{Return value}:
2424 The return value is a scalar of type @code{REAL(*)} and it is positive
2425 (@math{ 0 \leq erfc (x) \leq 2 }.
2427 @item @emph{Example}:
2430 real(8) :: x = 0.17_8
2432 end program test_erfc
2435 @item @emph{Specific names}:
2436 @multitable @columnfractions .24 .24 .24 .24
2437 @item Name @tab Argument @tab Return type @tab Option
2438 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
2445 @section @code{ETIME} --- Execution time subroutine (or function)
2446 @findex @code{ETIME} intrinsic
2447 @cindex ETIME subroutine
2450 @item @emph{Description}:
2451 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
2452 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2453 returns the user and system components of this time in @code{TARRAY(1)} and
2454 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
2456 On some systems, the underlying timings are represented using types with
2457 sufficiently small limits that overflows (wraparounds) are possible, such as
2458 32-bit types. Therefore, the values returned by this intrinsic might be, or
2459 become, negative, or numerically less than previous values, during a single
2460 run of the compiled program.
2462 If @code{ETIME} is invoked as a function, it can not be invoked as a
2463 subroutine, and vice versa.
2465 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2467 @multitable @columnfractions .15 .30 .60
2468 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2469 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2470 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2473 @item @emph{Option}:
2479 @item @emph{Syntax}:
2480 @multitable @columnfractions .8
2481 @item @code{CALL ETIME(TARRAY, RESULT)}.
2482 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
2485 @item @emph{Arguments}:
2486 @multitable @columnfractions .15 .80
2487 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2488 @item @var{RESULT}@tab The type shall be @code{REAL}.
2491 @item @emph{Return value}:
2492 Elapsed time in seconds since the start of program execution.
2494 @item @emph{Example}:
2498 real, dimension(2) :: tarray
2500 call ETIME(tarray, result)
2504 do i=1,100000000 ! Just a delay
2507 call ETIME(tarray, result)
2511 end program test_etime
2518 @section @code{EXIT} --- Exit the program with status.
2523 @item @emph{Description}:
2524 @code{EXIT} causes immediate termination of the program with status. If status
2525 is omitted it returns the canonical @emph{success} for the system. All Fortran
2526 I/O units are closed.
2528 @item @emph{Option}:
2532 non-elemental subroutine
2534 @item @emph{Syntax}:
2535 @code{CALL EXIT([STATUS])}
2537 @item @emph{Arguments}:
2538 @multitable @columnfractions .15 .80
2539 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
2542 @item @emph{Return value}:
2543 @code{STATUS} is passed to the parent process on exit.
2545 @item @emph{Example}:
2548 integer :: STATUS = 0
2549 print *, 'This program is going to exit.'
2551 end program test_exit
2558 @section @code{EXP} --- Exponential function
2559 @findex @code{EXP} intrinsic
2560 @findex @code{DEXP} intrinsic
2561 @findex @code{ZEXP} intrinsic
2562 @findex @code{CDEXP} intrinsic
2566 @item @emph{Description}:
2567 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
2569 @item @emph{Option}:
2575 @item @emph{Syntax}:
2578 @item @emph{Arguments}:
2579 @multitable @columnfractions .15 .80
2580 @item @var{X} @tab The type shall be @code{REAL(*)} or
2584 @item @emph{Return value}:
2585 The return value has same type and kind as @var{X}.
2587 @item @emph{Example}:
2592 end program test_exp
2595 @item @emph{Specific names}:
2596 @multitable @columnfractions .24 .24 .24 .24
2597 @item Name @tab Argument @tab Return type @tab Option
2598 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2599 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2600 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2601 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2608 @section @code{EXPONENT} --- Exponent function
2609 @findex @code{EXPONENT} intrinsic
2610 @cindex exponent function
2613 @item @emph{Description}:
2614 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
2615 is zero the value returned is zero.
2617 @item @emph{Option}:
2623 @item @emph{Syntax}:
2624 @code{I = EXPONENT(X)}
2626 @item @emph{Arguments}:
2627 @multitable @columnfractions .15 .80
2628 @item @var{X} @tab The type shall be @code{REAL(*)}.
2631 @item @emph{Return value}:
2632 The return value is of type default @code{INTEGER}.
2634 @item @emph{Example}:
2636 program test_exponent
2641 print *, exponent(0.0)
2642 end program test_exponent
2649 @section @code{FLOOR} --- Integer floor function
2650 @findex @code{FLOOR} intrinsic
2654 @item @emph{Description}:
2655 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
2657 @item @emph{Option}:
2663 @item @emph{Syntax}:
2664 @code{I = FLOOR(X[,KIND])}
2666 @item @emph{Arguments}:
2667 @multitable @columnfractions .15 .80
2668 @item @var{X} @tab The type shall be @code{REAL(*)}.
2669 @item @var{KIND} @tab Optional scaler integer initialization expression.
2672 @item @emph{Return value}:
2673 The return value is of type @code{INTEGER(KIND)}
2675 @item @emph{Example}:
2680 print *, floor(x) ! returns 63
2681 print *, floor(y) ! returns -64
2682 end program test_floor
2689 @section @code{FNUM} --- File number function
2690 @findex @code{FNUM} intrinsic
2694 @item @emph{Description}:
2695 @code{FNUM(UNIT)} returns the Posix file descriptor number corresponding to the
2696 open Fortran I/O unit @code{UNIT}.
2698 @item @emph{Option}:
2702 non-elemental function
2704 @item @emph{Syntax}:
2705 @code{I = FNUM(UNIT)}
2707 @item @emph{Arguments}:
2708 @multitable @columnfractions .15 .80
2709 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
2712 @item @emph{Return value}:
2713 The return value is of type @code{INTEGER}
2715 @item @emph{Example}:
2719 open (unit=10, status = "scratch")
2723 end program test_fnum
2730 @section @code{LOG} --- Logarithm function
2731 @findex @code{LOG} intrinsic
2732 @findex @code{ALOG} intrinsic
2733 @findex @code{DLOG} intrinsic
2734 @findex @code{CLOG} intrinsic
2735 @findex @code{ZLOG} intrinsic
2736 @findex @code{CDLOG} intrinsic
2740 @item @emph{Description}:
2741 @code{LOG(X)} computes the logarithm of @var{X}.
2743 @item @emph{Option}:
2749 @item @emph{Syntax}:
2752 @item @emph{Arguments}:
2753 @multitable @columnfractions .15 .80
2754 @item @var{X} @tab The type shall be @code{REAL(*)} or
2758 @item @emph{Return value}:
2759 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2760 The kind type parameter is the same as @var{X}.
2762 @item @emph{Example}:
2765 real(8) :: x = 1.0_8
2766 complex :: z = (1.0, 2.0)
2769 end program test_log
2772 @item @emph{Specific names}:
2773 @multitable @columnfractions .24 .24 .24 .24
2774 @item Name @tab Argument @tab Return type @tab Option
2775 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
2776 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2777 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2778 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2779 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2786 @section @code{LOG10} --- Base 10 logarithm function
2787 @findex @code{LOG10} intrinsic
2788 @findex @code{ALOG10} intrinsic
2789 @findex @code{DLOG10} intrinsic
2793 @item @emph{Description}:
2794 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
2796 @item @emph{Option}:
2802 @item @emph{Syntax}:
2805 @item @emph{Arguments}:
2806 @multitable @columnfractions .15 .80
2807 @item @var{X} @tab The type shall be @code{REAL(*)} or
2811 @item @emph{Return value}:
2812 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2813 The kind type parameter is the same as @var{X}.
2815 @item @emph{Example}:
2818 real(8) :: x = 10.0_8
2820 end program test_log10
2823 @item @emph{Specific names}:
2824 @multitable @columnfractions .24 .24 .24 .24
2825 @item Name @tab Argument @tab Return type @tab Option
2826 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
2827 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2833 @section @code{REAL} --- Convert to real type
2834 @findex @code{REAL} intrinsic
2835 @findex @code{REALPART} intrinsic
2839 @item @emph{Description}:
2840 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
2841 @code{REALPART(X)} function is provided for compatibility with @command{g77},
2842 and its use is strongly discouraged.
2844 @item @emph{Option}:
2848 transformational function
2850 @item @emph{Syntax}:
2851 @multitable @columnfractions .30 .80
2852 @item @code{X = REAL(X)}
2853 @item @code{X = REAL(X, KIND)}
2854 @item @code{X = REALPART(Z)}
2857 @item @emph{Arguments}:
2858 @multitable @columnfractions .15 .80
2859 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
2861 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
2864 @item @emph{Return value}:
2865 These functions return the a @code{REAL(*)} variable or array under
2866 the following rules:
2870 @code{REAL(X)} is converted to a default real type if @var{X} is an
2871 integer or real variable.
2873 @code{REAL(X)} is converted to a real type with the kind type parameter
2874 of @var{X} if @var{X} is a complex variable.
2876 @code{REAL(X, KIND)} is converted to a real type with kind type
2877 parameter @var{KIND} if @var{X} is a complex, integer, or real
2881 @item @emph{Example}:
2884 complex :: x = (1.0, 2.0)
2885 print *, real(x), real(x,8), realpart(x)
2886 end program test_real
2892 @section @code{SIN} --- Sine function
2893 @findex @code{SIN} intrinsic
2894 @findex @code{DSIN} intrinsic
2895 @findex @code{ZSIN} intrinsic
2896 @findex @code{CDSIN} intrinsic
2900 @item @emph{Description}:
2901 @code{SIN(X)} computes the sine of @var{X}.
2903 @item @emph{Option}:
2909 @item @emph{Syntax}:
2912 @item @emph{Arguments}:
2913 @multitable @columnfractions .15 .80
2914 @item @var{X} @tab The type shall be @code{REAL(*)} or
2918 @item @emph{Return value}:
2919 The return value has same type and king than @var{X}.
2921 @item @emph{Example}:
2926 end program test_sin
2929 @item @emph{Specific names}:
2930 @multitable @columnfractions .24 .24 .24 .24
2931 @item Name @tab Argument @tab Return type @tab Option
2932 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2933 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2934 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2935 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2942 @section @code{SINH} --- Hyperbolic sine function
2943 @findex @code{SINH} intrinsic
2944 @findex @code{DSINH} intrinsic
2945 @cindex hyperbolic sine
2948 @item @emph{Description}:
2949 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
2951 @item @emph{Option}:
2957 @item @emph{Syntax}:
2960 @item @emph{Arguments}:
2961 @multitable @columnfractions .15 .80
2962 @item @var{X} @tab The type shall be @code{REAL(*)}.
2965 @item @emph{Return value}:
2966 The return value is of type @code{REAL(*)}.
2968 @item @emph{Example}:
2971 real(8) :: x = - 1.0_8
2973 end program test_sinh
2976 @item @emph{Specific names}:
2977 @multitable @columnfractions .24 .24 .24 .24
2978 @item Name @tab Argument @tab Return type @tab Option
2979 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2986 @section @code{SQRT} --- Square-root function
2987 @findex @code{SQRT} intrinsic
2988 @findex @code{DSQRT} intrinsic
2989 @findex @code{CSQRT} intrinsic
2990 @findex @code{ZSQRT} intrinsic
2991 @findex @code{CDSQRT} intrinsic
2995 @item @emph{Description}:
2996 @code{SQRT(X)} computes the square root of @var{X}.
2998 @item @emph{Option}:
3004 @item @emph{Syntax}:
3007 @item @emph{Arguments}:
3008 @multitable @columnfractions .15 .80
3009 @item @var{X} @tab The type shall be @code{REAL(*)} or
3013 @item @emph{Return value}:
3014 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
3015 The kind type parameter is the same as @var{X}.
3017 @item @emph{Example}:
3020 real(8) :: x = 2.0_8
3021 complex :: z = (1.0, 2.0)
3024 end program test_sqrt
3027 @item @emph{Specific names}:
3028 @multitable @columnfractions .24 .24 .24 .24
3029 @item Name @tab Argument @tab Return type @tab Option
3030 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
3031 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
3032 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
3033 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
3040 @section @code{TAN} --- Tangent function
3041 @findex @code{TAN} intrinsic
3042 @findex @code{DTAN} intrinsic
3046 @item @emph{Description}:
3047 @code{TAN(X)} computes the tangent of @var{X}.
3049 @item @emph{Option}:
3055 @item @emph{Syntax}:
3058 @item @emph{Arguments}:
3059 @multitable @columnfractions .15 .80
3060 @item @var{X} @tab The type shall be @code{REAL(*)}.
3063 @item @emph{Return value}:
3064 The return value is of type @code{REAL(*)}. The kind type parameter is
3065 the same as @var{X}.
3067 @item @emph{Example}:
3070 real(8) :: x = 0.165_8
3072 end program test_tan
3075 @item @emph{Specific names}:
3076 @multitable @columnfractions .24 .24 .24 .24
3077 @item Name @tab Argument @tab Return type @tab Option
3078 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
3085 @section @code{TANH} --- Hyperbolic tangent function
3086 @findex @code{TANH} intrinsic
3087 @findex @code{DTANH} intrinsic
3088 @cindex hyperbolic tangent
3091 @item @emph{Description}:
3092 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
3094 @item @emph{Option}:
3100 @item @emph{Syntax}:
3103 @item @emph{Arguments}:
3104 @multitable @columnfractions .15 .80
3105 @item @var{X} @tab The type shall be @code{REAL(*)}.
3108 @item @emph{Return value}:
3109 The return value is of type @code{REAL(*)} and lies in the range
3110 @math{ - 1 \leq tanh(x) \leq 1 }.
3112 @item @emph{Example}:
3115 real(8) :: x = 2.1_8
3117 end program test_tanh
3120 @item @emph{Specific names}:
3121 @multitable @columnfractions .24 .24 .24 .24
3122 @item Name @tab Argument @tab Return type @tab Option
3123 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
3131 @comment gen fraction
3149 @comment sub get_command
3151 @comment sub get_command_argument
3153 @comment sub get_environment_variable
3193 @comment gen len_trim
3203 @comment gen logical
3214 @comment gen maxexponent
3229 @comment gen minexponent
3243 @comment gen nearest
3254 @comment gen precision
3256 @comment gen present
3258 @comment gen product
3265 @comment sub random_number
3267 @comment sub random_seed
3277 @comment gen reshape
3279 @comment gen rrspacing
3288 @comment gen selected_int_kind
3290 @comment gen selected_real_kind
3292 @comment gen set_exponent
3302 @comment gen spacing
3316 @comment sub system_clock
3320 @comment gen transfer
3322 @comment gen transpose