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{SQRT}: SQRT, Square-root function
93 * @code{SIN}: SIN, Sine function
94 * @code{SINH}: SINH, Hyperbolic sine function
95 * @code{TAN}: TAN, Tangent function
96 * @code{TANH}: TANH, Hyperbolic tangent function
100 @section Introduction to intrinsic procedures
102 Gfortran provides a rich set of intrinsic procedures that includes all
103 the intrinsic procedures required by the Fortran 95 standard, a set of
104 intrinsic procedures for backwards compatibility with Gnu Fortran 77
105 (i.e., @command{g77}), and a small selection of intrinsic procedures
106 from the Fortran 2003 standard. Any description here, which conflicts with a
107 description in either the Fortran 95 standard or the Fortran 2003 standard,
108 is unintentional and the standard(s) should be considered authoritative.
110 The enumeration of the @code{KIND} type parameter is processor defined in
111 the Fortran 95 standard. Gfortran defines the default integer type and
112 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
113 respectively. The standard mandates that both data types shall have
114 another kind, which have more precision. On typical target architectures
115 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
116 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
117 In the description of generic intrinsic procedures, the kind type parameter
118 will be specified by @code{KIND=*}, and in the description of specific
119 names for an intrinsic procedure the kind type parameter will be explicitly
120 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
121 brevity the optional @code{KIND=} syntax will be omitted.
123 Many of the intrinsics procedures take one or more optional arguments.
124 This document follows the convention used in the Fortran 95 standard,
125 and denotes such arguments by square brackets.
127 @command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
128 which can be used to restrict the set of intrinsic procedures to a
129 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
130 option, and so all intrinsic procedures described here are accepted. There
131 is one caveat. For a select group of intrinsic procedures, @command{g77}
132 implemented both a function and a subroutine. Both classes
133 have been implemented in @command{gfortran} for backwards compatibility
134 with @command{g77}. It is noted here that these functions and subroutines
135 cannot be intermixed in a given subprogram. In the descriptions that follow,
136 the applicable option(s) is noted.
141 @section @code{ABORT} --- Abort the program
146 @item @emph{Description}:
147 @code{ABORT} causes immediate termination of the program. On operating
148 systems that support a core dump, @code{ABORT} will produce a core dump,
149 which is suitable for debugging purposes.
155 non-elemental subroutine
160 @item @emph{Return value}:
163 @item @emph{Example}:
166 integer :: i = 1, j = 2
167 if (i /= j) call abort
168 end program test_abort
175 @section @code{ABS} --- Absolute value
176 @findex @code{ABS} intrinsic
177 @findex @code{CABS} intrinsic
178 @findex @code{DABS} intrinsic
179 @findex @code{IABS} intrinsic
180 @findex @code{ZABS} intrinsic
181 @findex @code{CDABS} intrinsic
182 @cindex absolute value
185 @item @emph{Description}:
186 @code{ABS(X)} computes the absolute value of @code{X}.
197 @item @emph{Arguments}:
198 @multitable @columnfractions .15 .80
199 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
200 @code{REAL(*)}, or @code{COMPLEX(*)}.
203 @item @emph{Return value}:
204 The return value is of the same type and
205 kind as the argument except the return value is @code{REAL(*)} for a
206 @code{COMPLEX(*)} argument.
208 @item @emph{Example}:
213 complex :: z = (-1.e0,0.e0)
220 @item @emph{Specific names}:
221 @multitable @columnfractions .24 .24 .24 .24
222 @item Name @tab Argument @tab Return type @tab Option
223 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab f95, gnu
224 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
225 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu
226 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
227 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
234 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
235 @findex @code{ACHAR} intrinsic
236 @cindex @acronym{ASCII} collating sequence
239 @item @emph{Description}:
240 @code{ACHAR(I)} returns the character located at position @code{I}
241 in the @acronym{ASCII} collating sequence.
252 @item @emph{Arguments}:
253 @multitable @columnfractions .15 .80
254 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
257 @item @emph{Return value}:
258 The return value is of type @code{CHARACTER} with a length of one. The
259 kind type parameter is the same as @code{KIND('A')}.
261 @item @emph{Example}:
266 end program test_achar
273 @section @code{ACOS} --- Arc cosine function
274 @findex @code{ACOS} intrinsic
275 @findex @code{DACOS} intrinsic
279 @item @emph{Description}:
280 @code{ACOS(X)} computes the arc cosine of @var{X}.
291 @item @emph{Arguments}:
292 @multitable @columnfractions .15 .80
293 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
297 @item @emph{Return value}:
298 The return value is of type @code{REAL(*)} and it lies in the
299 range @math{ 0 \leq \arccos (x) \leq \pi}. The kind type
300 parameter is the same as @var{X}.
302 @item @emph{Example}:
305 real(8) :: x = 0.866_8
307 end program test_acos
310 @item @emph{Specific names}:
311 @multitable @columnfractions .24 .24 .24 .24
312 @item Name @tab Argument @tab Return type @tab Option
313 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
320 @section @code{ADJUSTL} --- Left adjust a string
321 @findex @code{ADJUSTL} intrinsic
322 @cindex adjust string
325 @item @emph{Description}:
326 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
327 Spaces are inserted at the end of the string as needed.
336 @code{STR = ADJUSTL(STR)}
338 @item @emph{Arguments}:
339 @multitable @columnfractions .15 .80
340 @item @var{STR} @tab The type shall be @code{CHARACTER}.
343 @item @emph{Return value}:
344 The return value is of type @code{CHARACTER} where leading spaces
345 are removed and the same number of spaces are inserted on the end
348 @item @emph{Example}:
351 character(len=20) :: str = ' gfortran'
354 end program test_adjustl
361 @section @code{ADJUSTR} --- Right adjust a string
362 @findex @code{ADJUSTR} intrinsic
363 @cindex adjust string
366 @item @emph{Description}:
367 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
368 Spaces are inserted at the start of the string as needed.
377 @code{STR = ADJUSTR(STR)}
379 @item @emph{Arguments}:
380 @multitable @columnfractions .15 .80
381 @item @var{STR} @tab The type shall be @code{CHARACTER}.
384 @item @emph{Return value}:
385 The return value is of type @code{CHARACTER} where trailing spaces
386 are removed and the same number of spaces are inserted at the start
389 @item @emph{Example}:
392 character(len=20) :: str = 'gfortran'
395 end program test_adjustr
402 @section @code{AIMAG} --- Imaginary part of complex number
403 @findex @code{AIMAG} intrinsic
404 @findex @code{DIMAG} intrinsic
405 @cindex Imaginary part
408 @item @emph{Description}:
409 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
420 @item @emph{Arguments}:
421 @multitable @columnfractions .15 .80
422 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
425 @item @emph{Return value}:
426 The return value is of type real with the
427 kind type parameter of the argument.
429 @item @emph{Example}:
434 z4 = cmplx(1.e0_4, 0.e0_4)
435 z8 = cmplx(0.e0_8, 1.e0_8)
436 print *, aimag(z4), dimag(z8)
437 end program test_aimag
440 @item @emph{Specific names}:
441 @multitable @columnfractions .24 .24 .24 .24
442 @item Name @tab Argument @tab Return type @tab Option
443 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab f95, gnu
450 @section @code{AINT} --- Imaginary part of complex number
451 @findex @code{AINT} intrinsic
452 @findex @code{DINT} intrinsic
456 @item @emph{Description}:
457 @code{AINT(X [, KIND])} truncates its argument to a whole number.
467 @code{X = AINT(X, KIND)}
469 @item @emph{Arguments}:
470 @multitable @columnfractions .15 .80
471 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
472 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
473 initialization expression.
476 @item @emph{Return value}:
477 The return value is of type real with the kind type parameter of the
478 argument if the optional @var{KIND} is absent; otherwise, the kind
479 type parameter will be given by @var{KIND}. If the magnitude of
480 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
481 magnitude is equal to or greater than one, then it returns the largest
482 whole number that does not exceed its magnitude. The sign is the same
483 as the sign of @var{X}.
485 @item @emph{Example}:
492 print *, aint(x4), dint(x8)
494 end program test_aint
497 @item @emph{Specific names}:
498 @multitable @columnfractions .24 .24 .24 .24
499 @item Name @tab Argument @tab Return type @tab Option
500 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
507 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
508 @findex @code{ALL} intrinsic
512 @item @emph{Description}:
513 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
514 in the array along dimension @var{DIM}.
520 transformational function
524 @code{L = ALL(MASK, DIM)}
526 @item @emph{Arguments}:
527 @multitable @columnfractions .15 .80
528 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
529 it shall not be scalar.
530 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
531 with a value that lies between one and the rank of @var{MASK}.
534 @item @emph{Return value}:
535 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
536 the kind type parameter is the same as the kind type parameter of
537 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
538 an array with the rank of @var{MASK} minus 1. The shape is determined from
539 the shape of @var{MASK} where the @var{DIM} dimension is elided.
543 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
544 It also is true if @var{MASK} has zero size; otherwise, it is false.
546 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
547 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
548 is determined by applying @code{ALL} to the array sections.
551 @item @emph{Example}:
555 l = all((/.true., .true., .true./))
560 integer a(2,3), b(2,3)
564 print *, all(a .eq. b, 1)
565 print *, all(a .eq. b, 2)
566 end subroutine section
574 @section @code{ALLOCATED} --- Status of an allocatable entity
575 @findex @code{ALLOCATED} intrinsic
576 @cindex allocation status
579 @item @emph{Description}:
580 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
589 @code{L = ALLOCATED(X)}
591 @item @emph{Arguments}:
592 @multitable @columnfractions .15 .80
593 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
596 @item @emph{Return value}:
597 The return value is a scalar @code{LOGICAL} with the default logical
598 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
599 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
601 @item @emph{Example}:
603 program test_allocated
605 real(4), allocatable :: x(:)
606 if (allocated(x) .eqv. .false.) allocate(x(i)
607 end program test_allocated
614 @section @code{ANINT} --- Imaginary part of complex number
615 @findex @code{ANINT} intrinsic
616 @findex @code{DNINT} intrinsic
620 @item @emph{Description}:
621 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
631 @code{X = ANINT(X, KIND)}
633 @item @emph{Arguments}:
634 @multitable @columnfractions .15 .80
635 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
636 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
637 initialization expression.
640 @item @emph{Return value}:
641 The return value is of type real with the kind type parameter of the
642 argument if the optional @var{KIND} is absent; otherwise, the kind
643 type parameter will be given by @var{KIND}. If @var{X} is greater than
644 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
645 less than or equal to zero, then return @code{AINT(X-0.5)}.
647 @item @emph{Example}:
654 print *, anint(x4), dnint(x8)
656 end program test_anint
659 @item @emph{Specific names}:
660 @multitable @columnfractions .24 .24 .24 .24
661 @item Name @tab Argument @tab Return type @tab Option
662 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
669 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
670 @findex @code{ANY} intrinsic
674 @item @emph{Description}:
675 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
676 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
682 transformational function
686 @code{L = ANY(MASK, DIM)}
688 @item @emph{Arguments}:
689 @multitable @columnfractions .15 .80
690 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
691 it shall not be scalar.
692 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
693 with a value that lies between one and the rank of @var{MASK}.
696 @item @emph{Return value}:
697 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
698 the kind type parameter is the same as the kind type parameter of
699 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
700 an array with the rank of @var{MASK} minus 1. The shape is determined from
701 the shape of @var{MASK} where the @var{DIM} dimension is elided.
705 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
706 otherwise, it is false. It also is false if @var{MASK} has zero size.
708 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
709 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
710 is determined by applying @code{ANY} to the array sections.
713 @item @emph{Example}:
717 l = any((/.true., .true., .true./))
722 integer a(2,3), b(2,3)
726 print *, any(a .eq. b, 1)
727 print *, any(a .eq. b, 2)
728 end subroutine section
736 @section @code{ASIN} --- Arcsine function
737 @findex @code{ASIN} intrinsic
738 @findex @code{DASIN} intrinsic
742 @item @emph{Description}:
743 @code{ASIN(X)} computes the arcsine of its @var{X}.
754 @item @emph{Arguments}:
755 @multitable @columnfractions .15 .80
756 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
760 @item @emph{Return value}:
761 The return value is of type @code{REAL(*)} and it lies in the
762 range @math{-\pi / 2 \leq \arccos (x) \leq \pi / 2}. The kind type
763 parameter is the same as @var{X}.
765 @item @emph{Example}:
768 real(8) :: x = 0.866_8
770 end program test_asin
773 @item @emph{Specific names}:
774 @multitable @columnfractions .24 .24 .24 .24
775 @item Name @tab Argument @tab Return type @tab Option
776 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
783 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
784 @findex @code{ASSOCIATED} intrinsic
785 @cindex pointer status
788 @item @emph{Description}:
789 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
790 or if @var{PTR} is associated with the target @var{TGT}.
799 @code{L = ASSOCIATED(PTR)}
800 @code{L = ASSOCIATED(PTR [, TGT])}
802 @item @emph{Arguments}:
803 @multitable @columnfractions .15 .80
804 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
805 it can be of any type.
806 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
807 a @code{TARGET}. It must have the same type, kind type parameter, and
808 array rank as @var{PTR}.
810 The status of neither @var{PTR} nor @var{TGT} can be undefined.
812 @item @emph{Return value}:
813 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
814 There are several cases:
816 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
817 is true if @var{PTR} is associated with a target; otherwise, it returns false.
818 @item (B) If @var{TGT} is present and a scalar target, the result is true if
820 is not a 0 sized storage sequence and the target associated with @var{PTR}
821 occupies the same storage units. If @var{PTR} is disassociated, then the
823 @item (C) If @var{TGT} is present and an array target, the result is true if
824 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
825 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
826 @var{PTR} occupy the same storage units in array element order.
827 As in case(B), the result is false, if @var{PTR} is disassociated.
828 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
829 target associated with @var{PTR} and the target associated with @var{TGT}
830 are not 0 sized storage sequences and occupy the same storage units.
831 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
832 @item (E) If @var{TGT} is present and an array pointer, the result is true if
833 target associated with @var{PTR} and the target associated with @var{TGT}
834 have the same shape, are not 0 sized arrays, are arrays whose elements are
835 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
836 storage units in array element order.
837 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
840 @item @emph{Example}:
842 program test_associated
844 real, target :: tgt(2) = (/1., 2./)
845 real, pointer :: ptr(:)
847 if (associated(ptr) .eqv. .false.) call abort
848 if (associated(ptr,tgt) .eqv. .false.) call abort
849 end program test_associated
856 @section @code{ATAN} --- Arctangent function
857 @findex @code{ATAN} intrinsic
858 @findex @code{DATAN} intrinsic
862 @item @emph{Description}:
863 @code{ATAN(X)} computes the arctangent of @var{X}.
874 @item @emph{Arguments}:
875 @multitable @columnfractions .15 .80
876 @item @var{X} @tab The type shall be @code{REAL(*)}.
879 @item @emph{Return value}:
880 The return value is of type @code{REAL(*)} and it lies in the
881 range @math{ - \pi / 2 \leq \arcsin (x) \leq \pi / 2}.
883 @item @emph{Example}:
886 real(8) :: x = 2.866_8
888 end program test_atan
891 @item @emph{Specific names}:
892 @multitable @columnfractions .24 .24 .24 .24
893 @item Name @tab Argument @tab Return type @tab Option
894 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
901 @section @code{ATAN2} --- Arctangent function
902 @findex @code{ATAN2} intrinsic
903 @findex @code{DATAN2} intrinsic
907 @item @emph{Description}:
908 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
917 @code{X = ATAN2(Y,X)}
919 @item @emph{Arguments}:
920 @multitable @columnfractions .15 .80
921 @item @var{Y} @tab The type shall be @code{REAL(*)}.
922 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
923 If @var{Y} is zero, then @var{X} must be nonzero.
926 @item @emph{Return value}:
927 The return value has the same type and kind type parameter as @var{Y}.
928 It is the principle value of the complex number @math{X + i Y}. If
929 @var{X} is nonzero, then it lies in the range @math{-\pi \le \arccos (x) \leq \pi}.
930 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
931 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
932 is negative. Finally, if @var{X} is zero, then the magnitude of the result
935 @item @emph{Example}:
938 real(4) :: x = 1.e0_4, y = 0.5e0_4
940 end program test_atan2
943 @item @emph{Specific names}:
944 @multitable @columnfractions .24 .24 .24 .24
945 @item Name @tab Argument @tab Return type @tab Option
946 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
953 @section @code{BESJ0} --- Bessel function of the first kind of order 0
954 @findex @code{BESJ0} intrinsic
955 @findex @code{DBESJ0} intrinsic
959 @item @emph{Description}:
960 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
972 @item @emph{Arguments}:
973 @multitable @columnfractions .15 .80
974 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
977 @item @emph{Return value}:
978 The return value is of type @code{REAL(*)} and it lies in the
979 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
981 @item @emph{Example}:
986 end program test_besj0
989 @item @emph{Specific names}:
990 @multitable @columnfractions .24 .24 .24 .24
991 @item Name @tab Argument @tab Return type @tab Option
992 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
999 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1000 @findex @code{BESJ1} intrinsic
1001 @findex @code{DBESJ1} intrinsic
1005 @item @emph{Description}:
1006 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1009 @item @emph{Option}:
1015 @item @emph{Syntax}:
1018 @item @emph{Arguments}:
1019 @multitable @columnfractions .15 .80
1020 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1023 @item @emph{Return value}:
1024 The return value is of type @code{REAL(*)} and it lies in the
1025 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1027 @item @emph{Example}:
1030 real(8) :: x = 1.0_8
1032 end program test_besj1
1035 @item @emph{Specific names}:
1036 @multitable @columnfractions .24 .24 .24 .24
1037 @item Name @tab Argument @tab Return type @tab Option
1038 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1045 @section @code{BESJN} --- Bessel function of the first kind
1046 @findex @code{BESJN} intrinsic
1047 @findex @code{DBESJN} intrinsic
1051 @item @emph{Description}:
1052 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1055 @item @emph{Option}:
1061 @item @emph{Syntax}:
1062 @code{Y = BESJN(N, X)}
1064 @item @emph{Arguments}:
1065 @multitable @columnfractions .15 .80
1066 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1067 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1070 @item @emph{Return value}:
1071 The return value is a scalar of type @code{REAL(*)}.
1073 @item @emph{Example}:
1076 real(8) :: x = 1.0_8
1078 end program test_besjn
1081 @item @emph{Specific names}:
1082 @multitable @columnfractions .24 .24 .24 .24
1083 @item Name @tab Argument @tab Return type @tab Option
1084 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1085 @item @tab @code{REAL(8) X} @tab @tab
1092 @section @code{BESY0} --- Bessel function of the second kind of order 0
1093 @findex @code{BESY0} intrinsic
1094 @findex @code{DBESY0} intrinsic
1098 @item @emph{Description}:
1099 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1102 @item @emph{Option}:
1108 @item @emph{Syntax}:
1111 @item @emph{Arguments}:
1112 @multitable @columnfractions .15 .80
1113 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1116 @item @emph{Return value}:
1117 The return value is a scalar of type @code{REAL(*)}.
1119 @item @emph{Example}:
1122 real(8) :: x = 0.0_8
1124 end program test_besy0
1127 @item @emph{Specific names}:
1128 @multitable @columnfractions .24 .24 .24 .24
1129 @item Name @tab Argument @tab Return type @tab Option
1130 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1137 @section @code{BESY1} --- Bessel function of the second kind of order 1
1138 @findex @code{BESY1} intrinsic
1139 @findex @code{DBESY1} intrinsic
1143 @item @emph{Description}:
1144 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1147 @item @emph{Option}:
1153 @item @emph{Syntax}:
1156 @item @emph{Arguments}:
1157 @multitable @columnfractions .15 .80
1158 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1161 @item @emph{Return value}:
1162 The return value is a scalar of type @code{REAL(*)}.
1164 @item @emph{Example}:
1167 real(8) :: x = 1.0_8
1169 end program test_besy1
1172 @item @emph{Specific names}:
1173 @multitable @columnfractions .24 .24 .24 .24
1174 @item Name @tab Argument @tab Return type @tab Option
1175 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1182 @section @code{BESYN} --- Bessel function of the second kind
1183 @findex @code{BESYN} intrinsic
1184 @findex @code{DBESYN} intrinsic
1188 @item @emph{Description}:
1189 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1192 @item @emph{Option}:
1198 @item @emph{Syntax}:
1199 @code{Y = BESYN(N, X)}
1201 @item @emph{Arguments}:
1202 @multitable @columnfractions .15 .80
1203 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1204 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1207 @item @emph{Return value}:
1208 The return value is a scalar of type @code{REAL(*)}.
1210 @item @emph{Example}:
1213 real(8) :: x = 1.0_8
1215 end program test_besyn
1218 @item @emph{Specific names}:
1219 @multitable @columnfractions .24 .24 .24 .24
1220 @item Name @tab Argument @tab Return type @tab Option
1221 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1222 @item @tab @code{REAL(8) X} @tab @tab
1229 @section @code{BIT_SIZE} --- Bit size inquiry function
1230 @findex @code{BIT_SIZE} intrinsic
1234 @item @emph{Description}:
1235 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1236 represented by the type of @var{I}.
1238 @item @emph{Option}:
1244 @item @emph{Syntax}:
1245 @code{I = BIT_SIZE(I)}
1247 @item @emph{Arguments}:
1248 @multitable @columnfractions .15 .80
1249 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1252 @item @emph{Return value}:
1253 The return value is of type @code{INTEGER(*)}
1255 @item @emph{Example}:
1257 program test_bit_size
1262 end program test_bit_size
1269 @section @code{BTEST} --- Bit test function
1270 @findex @code{BTEST} intrinsic
1274 @item @emph{Description}:
1275 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1278 @item @emph{Option}:
1284 @item @emph{Syntax}:
1285 @code{I = BTEST(I,POS)}
1287 @item @emph{Arguments}:
1288 @multitable @columnfractions .15 .80
1289 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1290 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1293 @item @emph{Return value}:
1294 The return value is of type @code{LOGICAL}
1296 @item @emph{Example}:
1299 integer :: i = 32768 + 1024 + 64
1303 bool = btest(i, pos)
1306 end program test_btest
1313 @section @code{CEILING} --- Integer ceiling function
1314 @findex @code{CEILING} intrinsic
1318 @item @emph{Description}:
1319 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1321 @item @emph{Option}:
1327 @item @emph{Syntax}:
1328 @code{I = CEILING(X[,KIND])}
1330 @item @emph{Arguments}:
1331 @multitable @columnfractions .15 .80
1332 @item @var{X} @tab The type shall be @code{REAL(*)}.
1333 @item @var{KIND} @tab Optional scaler integer initialization expression.
1336 @item @emph{Return value}:
1337 The return value is of type @code{INTEGER(KIND)}
1339 @item @emph{Example}:
1341 program test_ceiling
1344 print *, ceiling(x) ! returns 64
1345 print *, ceiling(y) ! returns -63
1346 end program test_ceiling
1353 @section @code{CHAR} --- Character conversion function
1354 @findex @code{CHAR} intrinsic
1358 @item @emph{Description}:
1359 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1361 @item @emph{Option}:
1367 @item @emph{Syntax}:
1368 @code{C = CHAR(I[,KIND])}
1370 @item @emph{Arguments}:
1371 @multitable @columnfractions .15 .80
1372 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1373 @item @var{KIND} @tab Optional scaler integer initialization expression.
1376 @item @emph{Return value}:
1377 The return value is of type @code{CHARACTER(1)}
1379 @item @emph{Example}:
1385 print *, i, c ! returns 'J'
1386 end program test_char
1393 @section @code{CMPLX} --- Complex conversion function
1394 @findex @code{CMPLX} intrinsic
1398 @item @emph{Description}:
1399 @code{CMPLX(X,[Y,KIND])} returns a complex number where @var{X} is converted to
1400 the real component. If @var{Y} is present it is converted to the imaginary
1401 component. If @var{Y} is not present then the imaginary component is set to
1402 0.0. If @var{X} is complex then @var{Y} must not be present.
1404 @item @emph{Option}:
1410 @item @emph{Syntax}:
1411 @code{C = CMPLX(X[,Y,KIND])}
1413 @item @emph{Arguments}:
1414 @multitable @columnfractions .15 .80
1415 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1416 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1417 @item @var{KIND} @tab Optional scaler integer initialization expression.
1420 @item @emph{Return value}:
1421 The return value is of type @code{COMPLEX(*)}
1423 @item @emph{Example}:
1430 print *, z, cmplx(x)
1431 end program test_cmplx
1437 @node COMMAND_ARGUMENT_COUNT
1438 @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function
1439 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1440 @cindex command argument count
1443 @item @emph{Description}:
1444 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1445 command line when the containing program was invoked.
1447 @item @emph{Option}:
1451 non-elemental function
1453 @item @emph{Syntax}:
1454 @code{I = COMMAND_ARGUMENT_COUNT()}
1456 @item @emph{Arguments}:
1457 @multitable @columnfractions .15 .80
1461 @item @emph{Return value}:
1462 The return value is of type @code{INTEGER(4)}
1464 @item @emph{Example}:
1466 program test_command_argument_count
1468 count = command_argument_count()
1470 end program test_command_argument_count
1477 @section @code{CONJG} --- Complex conjugate function
1478 @findex @code{CONJG} intrinsic
1479 @findex @code{DCONJG} intrinsic
1480 @cindex complex conjugate
1482 @item @emph{Description}:
1483 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
1484 then the result is @code{(x, -y)}
1486 @item @emph{Option}:
1492 @item @emph{Syntax}:
1495 @item @emph{Arguments}:
1496 @multitable @columnfractions .15 .80
1497 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
1500 @item @emph{Return value}:
1501 The return value is of type @code{COMPLEX(*)}.
1503 @item @emph{Example}:
1506 complex :: z = (2.0, 3.0)
1507 complex(8) :: dz = (2.71_8, -3.14_8)
1512 end program test_conjg
1515 @item @emph{Specific names}:
1516 @multitable @columnfractions .24 .24 .24 .24
1517 @item Name @tab Argument @tab Return type @tab Option
1518 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
1525 @section @code{COS} --- Cosine function
1526 @findex @code{COS} intrinsic
1527 @findex @code{DCOS} intrinsic
1528 @findex @code{ZCOS} intrinsic
1529 @findex @code{CDCOS} intrinsic
1533 @item @emph{Description}:
1534 @code{COS(X)} computes the cosine of @var{X}.
1536 @item @emph{Option}:
1542 @item @emph{Syntax}:
1545 @item @emph{Arguments}:
1546 @multitable @columnfractions .15 .80
1547 @item @var{X} @tab The type shall be @code{REAL(*)} or
1551 @item @emph{Return value}:
1552 The return value has the same type and kind as @var{X}.
1554 @item @emph{Example}:
1559 end program test_cos
1562 @item @emph{Specific names}:
1563 @multitable @columnfractions .24 .24 .24 .24
1564 @item Name @tab Argument @tab Return type @tab Option
1565 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1566 @item @code{CCOS(X)}@tab @code{COMPLEX(4) X}@tab @code{COMPLEX(4)}@tab f95, gnu
1567 @item @code{ZCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1568 @item @code{CDCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1575 @section @code{COSH} --- Hyperbolic cosine function
1576 @findex @code{COSH} intrinsic
1577 @findex @code{DCOSH} intrinsic
1578 @cindex hyperbolic cosine
1581 @item @emph{Description}:
1582 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
1584 @item @emph{Option}:
1590 @item @emph{Syntax}:
1593 @item @emph{Arguments}:
1594 @multitable @columnfractions .15 .80
1595 @item @var{X} @tab The type shall be @code{REAL(*)}.
1598 @item @emph{Return value}:
1599 The return value is of type @code{REAL(*)} and it is positive
1600 (@math{ \cosh (x) \geq 0 }.
1602 @item @emph{Example}:
1605 real(8) :: x = 1.0_8
1607 end program test_cosh
1610 @item @emph{Specific names}:
1611 @multitable @columnfractions .24 .24 .24 .24
1612 @item Name @tab Argument @tab Return type @tab Option
1613 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1620 @section @code{COUNT} --- Count function
1621 @findex @code{COUNT} intrinsic
1625 @item @emph{Description}:
1626 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
1627 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
1628 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
1629 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
1631 @item @emph{Option}:
1635 transformational function
1637 @item @emph{Syntax}:
1638 @code{I = COUNT(MASK[,DIM])}
1640 @item @emph{Arguments}:
1641 @multitable @columnfractions .15 .80
1642 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
1643 @item @var{DIM} @tab The type shall be @code{INTEGER}.
1646 @item @emph{Return value}:
1647 The return value is of type @code{INTEGER} with rank equal to that of
1650 @item @emph{Example}:
1653 integer, dimension(2,3) :: a, b
1654 logical, dimension(2,3) :: mask
1655 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
1656 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
1657 print '(3i3)', a(1,:)
1658 print '(3i3)', a(2,:)
1660 print '(3i3)', b(1,:)
1661 print '(3i3)', b(2,:)
1664 print '(3l3)', mask(1,:)
1665 print '(3l3)', mask(2,:)
1667 print '(3i3)', count(mask)
1669 print '(3i3)', count(mask, 1)
1671 print '(3i3)', count(mask, 2)
1672 end program test_count
1679 @section @code{CPU_TIME} --- CPU elapsed time in seconds
1680 @findex @code{CPU_TIME} intrinsic
1684 @item @emph{Description}:
1685 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
1686 is useful for testing segments of code to determine execution time.
1688 @item @emph{Option}:
1694 @item @emph{Syntax}:
1697 @item @emph{Arguments}:
1698 @multitable @columnfractions .15 .80
1699 @item @var{X} @tab The type shall be @code{REAL} with intent out.
1702 @item @emph{Return value}:
1705 @item @emph{Example}:
1707 program test_cpu_time
1708 real :: start, finish
1709 call cpu_time(start)
1710 ! put code to test here
1711 call cpu_time(finish)
1712 print '("Time = ",f6.3," seconds.")',finish-start
1713 end program test_cpu_time
1720 @section @code{CSHIFT} --- Circular shift function
1721 @findex @code{CSHIFT} intrinsic
1722 @cindex cshift intrinsic
1725 @item @emph{Description}:
1726 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
1727 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
1728 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
1729 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
1730 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
1731 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
1732 sections of @var{ARRAY} along the given dimension are shifted. Elements
1733 shifted out one end of each rank one section are shifted back in the other end.
1735 @item @emph{Option}:
1739 transformational function
1741 @item @emph{Syntax}:
1742 @code{A = CSHIFT(A, SHIFT[,DIM])}
1744 @item @emph{Arguments}:
1745 @multitable @columnfractions .15 .80
1746 @item @var{ARRAY} @tab May be any type, not scaler.
1747 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
1748 @item @var{DIM} @tab The type shall be @code{INTEGER}.
1751 @item @emph{Return value}:
1752 Returns an array of same type and rank as the @var{ARRAY} argument.
1754 @item @emph{Example}:
1757 integer, dimension(3,3) :: a
1758 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
1759 print '(3i3)', a(1,:)
1760 print '(3i3)', a(2,:)
1761 print '(3i3)', a(3,:)
1762 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
1764 print '(3i3)', a(1,:)
1765 print '(3i3)', a(2,:)
1766 print '(3i3)', a(3,:)
1767 end program test_cshift
1774 @section @code{DATE_AND_TIME} --- Date and time subroutine
1775 @findex @code{DATE_AND_TIME} intrinsic
1776 @cindex DATE_AND_TIME
1779 @item @emph{Description}:
1780 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
1781 time information from the real-time system clock. @var{DATE} is
1782 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
1783 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
1784 representing the difference with respect to Coordinated Universal Time (UTC).
1785 Unavailable time and date parameters return blanks.
1787 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
1789 @multitable @columnfractions .15 .30 .60
1790 @item @tab @code{VALUE(1)}: @tab The year
1791 @item @tab @code{VALUE(2)}: @tab The month
1792 @item @tab @code{VALUE(3)}: @tab The day of the month
1793 @item @tab @code{VAlUE(4)}: @tab Time difference with UTC in minutes
1794 @item @tab @code{VALUE(5)}: @tab The hour of the day
1795 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
1796 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
1797 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
1800 @item @emph{Option}:
1806 @item @emph{Syntax}:
1807 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
1809 @item @emph{Arguments}:
1810 @multitable @columnfractions .15 .80
1811 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
1812 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
1813 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
1814 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
1817 @item @emph{Return value}:
1820 @item @emph{Example}:
1822 program test_time_and_date
1823 character(8) :: date
1824 character(10) :: time
1825 character(5) :: zone
1826 integer,dimension(8) :: values
1827 ! using keyword arguments
1828 call date_and_time(date,time,zone,values)
1829 call date_and_time(DATE=date,ZONE=zone)
1830 call date_and_time(TIME=time)
1831 call date_and_time(VALUES=values)
1832 print '(a,2x,a,2x,a)', date, time, zone
1833 print '(8i5))', values
1834 end program test_time_and_date
1841 @section @code{DBLE} --- Double conversion function
1842 @findex @code{DBLE} intrinsic
1843 @cindex double conversion
1846 @item @emph{Description}:
1847 @code{DBLE(X)} Converts @var{X} to double precision real type.
1848 @code{DFLOAT} is an alias for @code{DBLE}
1850 @item @emph{Option}:
1856 @item @emph{Syntax}:
1858 @code{X = DFLOAT(X)}
1860 @item @emph{Arguments}:
1861 @multitable @columnfractions .15 .80
1862 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1865 @item @emph{Return value}:
1866 The return value is of type double precision real.
1868 @item @emph{Example}:
1873 complex :: z = (2.3,1.14)
1874 print *, dble(x), dble(i), dfloat(z)
1875 end program test_dble
1882 @section @code{DCMPLX} --- Double complex conversion function
1883 @findex @code{DCMPLX} intrinsic
1887 @item @emph{Description}:
1888 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
1889 converted to the real component. If @var{Y} is present it is converted to the
1890 imaginary component. If @var{Y} is not present then the imaginary component is
1891 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
1893 @item @emph{Option}:
1899 @item @emph{Syntax}:
1900 @code{C = DCMPLX(X)}
1901 @code{C = DCMPLX(X,Y)}
1903 @item @emph{Arguments}:
1904 @multitable @columnfractions .15 .80
1905 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1906 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}.
1909 @item @emph{Return value}:
1910 The return value is of type @code{COMPLEX(8)}
1912 @item @emph{Example}:
1922 print *, dcmplx(x,i)
1923 end program test_dcmplx
1930 @section @code{DFLOAT} --- Double conversion function
1931 @findex @code{DFLOAT} intrinsic
1932 @cindex double float conversion
1935 @item @emph{Description}:
1936 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
1937 @code{DFLOAT} is an alias for @code{DBLE}. See @code{DBLE}.
1943 @section @code{DIGITS} --- Significant digits function
1944 @findex @code{DIGITS} intrinsic
1945 @cindex digits, significant
1948 @item @emph{Description}:
1949 @code{DIGITS(X)} returns the number of significant digits of the internal model
1950 representation of @var{X}. For example, on a system using a 32-bit
1951 floating point representation, a default real number would likely return 24.
1953 @item @emph{Option}:
1959 @item @emph{Syntax}:
1960 @code{C = DIGITS(X)}
1962 @item @emph{Arguments}:
1963 @multitable @columnfractions .15 .80
1964 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
1967 @item @emph{Return value}:
1968 The return value is of type @code{INTEGER}.
1970 @item @emph{Example}:
1973 integer :: i = 12345
1979 end program test_digits
1986 @section @code{DIM} --- Dim function
1987 @findex @code{DIM} intrinsic
1988 @findex @code{IDIM} intrinsic
1989 @findex @code{DDIM} intrinsic
1993 @item @emph{Description}:
1994 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
1995 otherwise returns zero.
1997 @item @emph{Option}:
2003 @item @emph{Syntax}:
2006 @item @emph{Arguments}:
2007 @multitable @columnfractions .15 .80
2008 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2009 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2012 @item @emph{Return value}:
2013 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2015 @item @emph{Example}:
2021 x = dim(4.345_8, 2.111_8)
2024 end program test_dim
2027 @item @emph{Specific names}:
2028 @multitable @columnfractions .24 .24 .24 .24
2029 @item Name @tab Argument @tab Return type @tab Option
2030 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab gnu
2031 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab gnu
2038 @section @code{DOT_PRODUCT} --- Dot product function
2039 @findex @code{DOT_PRODUCT} intrinsic
2043 @item @emph{Description}:
2044 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2045 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2046 and must be arrays of rank one and of equal size. If the vectors are
2047 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2048 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2049 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2051 @item @emph{Option}:
2055 transformational function
2057 @item @emph{Syntax}:
2058 @code{S = DOT_PRODUCT(X,Y)}
2060 @item @emph{Arguments}:
2061 @multitable @columnfractions .15 .80
2062 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2063 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2066 @item @emph{Return value}:
2067 If the arguments are numeric, the return value is a scaler of numeric type,
2068 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2069 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2071 @item @emph{Example}:
2073 program test_dot_prod
2074 integer, dimension(3) :: a, b
2081 print *, dot_product(a,b)
2082 end program test_dot_prod
2089 @section @code{DPROD} --- Double product function
2090 @findex @code{DPROD} intrinsic
2091 @cindex Double product
2094 @item @emph{Description}:
2095 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2097 @item @emph{Option}:
2103 @item @emph{Syntax}:
2104 @code{D = DPROD(X,Y)}
2106 @item @emph{Arguments}:
2107 @multitable @columnfractions .15 .80
2108 @item @var{X} @tab The type shall be @code{REAL}.
2109 @item @var{Y} @tab The type shall be @code{REAL}.
2112 @item @emph{Return value}:
2113 The return value is of type @code{REAL(8)}.
2115 @item @emph{Example}:
2124 end program test_dprod
2131 @section @code{DREAL} --- Double real part function
2132 @findex @code{DREAL} intrinsic
2133 @cindex Double real part
2136 @item @emph{Description}:
2137 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2139 @item @emph{Option}:
2145 @item @emph{Syntax}:
2148 @item @emph{Arguments}:
2149 @multitable @columnfractions .15 .80
2150 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2153 @item @emph{Return value}:
2154 The return value is of type @code{REAL(8)}.
2156 @item @emph{Example}:
2159 complex(8) :: z = (1.3_8,7.2_8)
2161 end program test_dreal
2168 @section @code{DTIME} --- Execution time subroutine (or function)
2169 @findex @code{DTIME} intrinsic
2170 @cindex dtime subroutine
2173 @item @emph{Description}:
2174 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2175 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2176 returns the user and system components of this time in @code{TARRAY(1)} and
2177 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2180 Subsequent invocations of @code{DTIME} return values accumulated since the
2181 previous invocation.
2183 On some systems, the underlying timings are represented using types with
2184 sufficiently small limits that overflows (wraparounds) are possible, such as
2185 32-bit types. Therefore, the values returned by this intrinsic might be, or
2186 become, negative, or numerically less than previous values, during a single
2187 run of the compiled program.
2189 If @code{DTIME} is invoked as a function, it can not be invoked as a
2190 subroutine, and vice versa.
2192 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2194 @multitable @columnfractions .15 .30 .60
2195 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2196 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2197 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2200 @item @emph{Option}:
2206 @item @emph{Syntax}:
2207 @multitable @columnfractions .80
2208 @item @code{CALL DTIME(TARRAY, RESULT)}.
2209 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2212 @item @emph{Arguments}:
2213 @multitable @columnfractions .15 .80
2214 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2215 @item @var{RESULT}@tab The type shall be @code{REAL}.
2218 @item @emph{Return value}:
2219 Elapsed time in seconds since the start of program execution.
2221 @item @emph{Example}:
2225 real, dimension(2) :: tarray
2227 call dtime(tarray, result)
2231 do i=1,100000000 ! Just a delay
2234 call dtime(tarray, result)
2238 end program test_dtime
2245 @section @code{EOSHIFT} --- End-off shift function
2246 @findex @code{EOSHIFT} intrinsic
2247 @cindex eoshift intrinsic
2250 @item @emph{Description}:
2251 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2252 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2253 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2254 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2255 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2256 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2257 then all complete rank one sections of @var{ARRAY} along the given dimension are
2258 shifted. Elements shifted out one end of each rank one section are dropped. If
2259 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2260 is copied back in the other end. If @var{BOUNDARY} is not present then the
2261 following are copied in depending on the type of @var{ARRAY}.
2263 @multitable @columnfractions .15 .80
2264 @item @emph{Array Type} @tab @emph{Boundary Value}
2265 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2266 @item Logical @tab @code{.FALSE.}.
2267 @item Character(@var{len}) @tab @var{len} blanks.
2270 @item @emph{Option}:
2274 transformational function
2276 @item @emph{Syntax}:
2277 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2279 @item @emph{Arguments}:
2280 @multitable @columnfractions .15 .80
2281 @item @var{ARRAY} @tab May be any type, not scaler.
2282 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2283 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2284 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2287 @item @emph{Return value}:
2288 Returns an array of same type and rank as the @var{ARRAY} argument.
2290 @item @emph{Example}:
2292 program test_eoshift
2293 integer, dimension(3,3) :: a
2294 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2295 print '(3i3)', a(1,:)
2296 print '(3i3)', a(2,:)
2297 print '(3i3)', a(3,:)
2298 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2300 print '(3i3)', a(1,:)
2301 print '(3i3)', a(2,:)
2302 print '(3i3)', a(3,:)
2303 end program test_eoshift
2310 @section @code{EPSILON} --- Epsilon function
2311 @findex @code{EPSILON} intrinsic
2312 @cindex epsilon, significant
2315 @item @emph{Description}:
2316 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2318 @item @emph{Option}:
2324 @item @emph{Syntax}:
2325 @code{C = EPSILON(X)}
2327 @item @emph{Arguments}:
2328 @multitable @columnfractions .15 .80
2329 @item @var{X} @tab The type shall be @code{REAL(*)}.
2332 @item @emph{Return value}:
2333 The return value is of same type as the argument.
2335 @item @emph{Example}:
2337 program test_epsilon
2342 end program test_epsilon
2349 @section @code{ERF} --- Error function
2350 @findex @code{ERF} intrinsic
2351 @cindex error function
2354 @item @emph{Description}:
2355 @code{ERF(X)} computes the error function of @var{X}.
2357 @item @emph{Option}:
2363 @item @emph{Syntax}:
2366 @item @emph{Arguments}:
2367 @multitable @columnfractions .15 .80
2368 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2371 @item @emph{Return value}:
2372 The return value is a scalar of type @code{REAL(*)} and it is positive
2373 (@math{ - 1 \leq erf (x) \leq 1 }.
2375 @item @emph{Example}:
2378 real(8) :: x = 0.17_8
2380 end program test_erf
2383 @item @emph{Specific names}:
2384 @multitable @columnfractions .24 .24 .24 .24
2385 @item Name @tab Argument @tab Return type @tab Option
2386 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
2393 @section @code{ERFC} --- Error function
2394 @findex @code{ERFC} intrinsic
2395 @cindex error function
2398 @item @emph{Description}:
2399 @code{ERFC(X)} computes the complementary error function of @var{X}.
2401 @item @emph{Option}:
2407 @item @emph{Syntax}:
2410 @item @emph{Arguments}:
2411 @multitable @columnfractions .15 .80
2412 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2415 @item @emph{Return value}:
2416 The return value is a scalar of type @code{REAL(*)} and it is positive
2417 (@math{ 0 \leq erfc (x) \leq 2 }.
2419 @item @emph{Example}:
2422 real(8) :: x = 0.17_8
2424 end program test_erfc
2427 @item @emph{Specific names}:
2428 @multitable @columnfractions .24 .24 .24 .24
2429 @item Name @tab Argument @tab Return type @tab Option
2430 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
2437 @section @code{ETIME} --- Execution time subroutine (or function)
2438 @findex @code{ETIME} intrinsic
2439 @cindex ETIME subroutine
2442 @item @emph{Description}:
2443 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
2444 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2445 returns the user and system components of this time in @code{TARRAY(1)} and
2446 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
2448 On some systems, the underlying timings are represented using types with
2449 sufficiently small limits that overflows (wraparounds) are possible, such as
2450 32-bit types. Therefore, the values returned by this intrinsic might be, or
2451 become, negative, or numerically less than previous values, during a single
2452 run of the compiled program.
2454 If @code{ETIME} is invoked as a function, it can not be invoked as a
2455 subroutine, and vice versa.
2457 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2459 @multitable @columnfractions .15 .30 .60
2460 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2461 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2462 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2465 @item @emph{Option}:
2471 @item @emph{Syntax}:
2472 @multitable @columnfractions .8
2473 @item @code{CALL ETIME(TARRAY, RESULT)}.
2474 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
2477 @item @emph{Arguments}:
2478 @multitable @columnfractions .15 .80
2479 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2480 @item @var{RESULT}@tab The type shall be @code{REAL}.
2483 @item @emph{Return value}:
2484 Elapsed time in seconds since the start of program execution.
2486 @item @emph{Example}:
2490 real, dimension(2) :: tarray
2492 call ETIME(tarray, result)
2496 do i=1,100000000 ! Just a delay
2499 call ETIME(tarray, result)
2503 end program test_etime
2510 @section @code{EXIT} --- Exit the program with status.
2515 @item @emph{Description}:
2516 @code{EXIT} causes immediate termination of the program with status. If status
2517 is omitted it returns the canonical @emph{success} for the system. All Fortran
2518 I/O units are closed.
2520 @item @emph{Option}:
2524 non-elemental subroutine
2526 @item @emph{Syntax}:
2527 @code{CALL EXIT([STATUS])}
2529 @item @emph{Arguments}:
2530 @multitable @columnfractions .15 .80
2531 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
2534 @item @emph{Return value}:
2535 @code{STATUS} is passed to the parent process on exit.
2537 @item @emph{Example}:
2540 integer :: STATUS = 0
2541 print *, 'This program is going to exit.'
2543 end program test_exit
2550 @section @code{EXP} --- Exponential function
2551 @findex @code{EXP} intrinsic
2552 @findex @code{DEXP} intrinsic
2553 @findex @code{ZEXP} intrinsic
2554 @findex @code{CDEXP} intrinsic
2558 @item @emph{Description}:
2559 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
2561 @item @emph{Option}:
2567 @item @emph{Syntax}:
2570 @item @emph{Arguments}:
2571 @multitable @columnfractions .15 .80
2572 @item @var{X} @tab The type shall be @code{REAL(*)} or
2576 @item @emph{Return value}:
2577 The return value has same type and kind as @var{X}.
2579 @item @emph{Example}:
2584 end program test_exp
2587 @item @emph{Specific names}:
2588 @multitable @columnfractions .24 .24 .24 .24
2589 @item Name @tab Argument @tab Return type @tab Option
2590 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2591 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2592 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2593 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2600 @section @code{EXPONENT} --- Exponent function
2601 @findex @code{EXPONENT} intrinsic
2602 @cindex exponent function
2605 @item @emph{Description}:
2606 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
2607 is zero the value returned is zero.
2609 @item @emph{Option}:
2615 @item @emph{Syntax}:
2616 @code{I = EXPONENT(X)}
2618 @item @emph{Arguments}:
2619 @multitable @columnfractions .15 .80
2620 @item @var{X} @tab The type shall be @code{REAL(*)}.
2623 @item @emph{Return value}:
2624 The return value is of type default @code{INTEGER}.
2626 @item @emph{Example}:
2628 program test_exponent
2633 print *, exponent(0.0)
2634 end program test_exponent
2641 @section @code{FLOOR} --- Integer floor function
2642 @findex @code{FLOOR} intrinsic
2646 @item @emph{Description}:
2647 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
2649 @item @emph{Option}:
2655 @item @emph{Syntax}:
2656 @code{I = FLOOR(X[,KIND])}
2658 @item @emph{Arguments}:
2659 @multitable @columnfractions .15 .80
2660 @item @var{X} @tab The type shall be @code{REAL(*)}.
2661 @item @var{KIND} @tab Optional scaler integer initialization expression.
2664 @item @emph{Return value}:
2665 The return value is of type @code{INTEGER(KIND)}
2667 @item @emph{Example}:
2672 print *, floor(x) ! returns 63
2673 print *, floor(y) ! returns -64
2674 end program test_floor
2681 @section @code{FNUM} --- File number function
2682 @findex @code{FNUM} intrinsic
2686 @item @emph{Description}:
2687 @code{FNUM(UNIT)} returns the Posix file descriptor number corresponding to the
2688 open Fortran I/O unit @code{UNIT}.
2690 @item @emph{Option}:
2694 non-elemental function
2696 @item @emph{Syntax}:
2697 @code{I = FNUM(UNIT)}
2699 @item @emph{Arguments}:
2700 @multitable @columnfractions .15 .80
2701 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
2704 @item @emph{Return value}:
2705 The return value is of type @code{INTEGER}
2707 @item @emph{Example}:
2711 open (unit=10, status = "scratch")
2715 end program test_fnum
2722 @section @code{LOG} --- Logarithm function
2723 @findex @code{LOG} intrinsic
2724 @findex @code{ALOG} intrinsic
2725 @findex @code{DLOG} intrinsic
2726 @findex @code{CLOG} intrinsic
2727 @findex @code{ZLOG} intrinsic
2728 @findex @code{CDLOG} intrinsic
2732 @item @emph{Description}:
2733 @code{LOG(X)} computes the logarithm of @var{X}.
2735 @item @emph{Option}:
2741 @item @emph{Syntax}:
2744 @item @emph{Arguments}:
2745 @multitable @columnfractions .15 .80
2746 @item @var{X} @tab The type shall be @code{REAL(*)} or
2750 @item @emph{Return value}:
2751 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2752 The kind type parameter is the same as @var{X}.
2754 @item @emph{Example}:
2757 real(8) :: x = 1.0_8
2758 complex :: z = (1.0, 2.0)
2761 end program test_log
2764 @item @emph{Specific names}:
2765 @multitable @columnfractions .24 .24 .24 .24
2766 @item Name @tab Argument @tab Return type @tab Option
2767 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
2768 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2769 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2770 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2771 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2778 @section @code{LOG10} --- Base 10 logarithm function
2779 @findex @code{LOG10} intrinsic
2780 @findex @code{ALOG10} intrinsic
2781 @findex @code{DLOG10} intrinsic
2785 @item @emph{Description}:
2786 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
2788 @item @emph{Option}:
2794 @item @emph{Syntax}:
2797 @item @emph{Arguments}:
2798 @multitable @columnfractions .15 .80
2799 @item @var{X} @tab The type shall be @code{REAL(*)} or
2803 @item @emph{Return value}:
2804 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2805 The kind type parameter is the same as @var{X}.
2807 @item @emph{Example}:
2810 real(8) :: x = 10.0_8
2812 end program test_log10
2815 @item @emph{Specific names}:
2816 @multitable @columnfractions .24 .24 .24 .24
2817 @item Name @tab Argument @tab Return type @tab Option
2818 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
2819 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2826 @section @code{SIN} --- Sine function
2827 @findex @code{SIN} intrinsic
2828 @findex @code{DSIN} intrinsic
2829 @findex @code{ZSIN} intrinsic
2830 @findex @code{CDSIN} intrinsic
2834 @item @emph{Description}:
2835 @code{SIN(X)} computes the sine of @var{X}.
2837 @item @emph{Option}:
2843 @item @emph{Syntax}:
2846 @item @emph{Arguments}:
2847 @multitable @columnfractions .15 .80
2848 @item @var{X} @tab The type shall be @code{REAL(*)} or
2852 @item @emph{Return value}:
2853 The return value has same type and king than @var{X}.
2855 @item @emph{Example}:
2860 end program test_sin
2863 @item @emph{Specific names}:
2864 @multitable @columnfractions .24 .24 .24 .24
2865 @item Name @tab Argument @tab Return type @tab Option
2866 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2867 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2868 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2869 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2876 @section @code{SINH} --- Hyperbolic sine function
2877 @findex @code{SINH} intrinsic
2878 @findex @code{DSINH} intrinsic
2879 @cindex hyperbolic sine
2882 @item @emph{Description}:
2883 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
2885 @item @emph{Option}:
2891 @item @emph{Syntax}:
2894 @item @emph{Arguments}:
2895 @multitable @columnfractions .15 .80
2896 @item @var{X} @tab The type shall be @code{REAL(*)}.
2899 @item @emph{Return value}:
2900 The return value is of type @code{REAL(*)}.
2902 @item @emph{Example}:
2905 real(8) :: x = - 1.0_8
2907 end program test_sinh
2910 @item @emph{Specific names}:
2911 @multitable @columnfractions .24 .24 .24 .24
2912 @item Name @tab Argument @tab Return type @tab Option
2913 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2920 @section @code{SQRT} --- Square-root function
2921 @findex @code{SQRT} intrinsic
2922 @findex @code{DSQRT} intrinsic
2923 @findex @code{CSQRT} intrinsic
2924 @findex @code{ZSQRT} intrinsic
2925 @findex @code{CDSQRT} intrinsic
2929 @item @emph{Description}:
2930 @code{SQRT(X)} computes the square root of @var{X}.
2932 @item @emph{Option}:
2938 @item @emph{Syntax}:
2941 @item @emph{Arguments}:
2942 @multitable @columnfractions .15 .80
2943 @item @var{X} @tab The type shall be @code{REAL(*)} or
2947 @item @emph{Return value}:
2948 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2949 The kind type parameter is the same as @var{X}.
2951 @item @emph{Example}:
2954 real(8) :: x = 2.0_8
2955 complex :: z = (1.0, 2.0)
2958 end program test_sqrt
2961 @item @emph{Specific names}:
2962 @multitable @columnfractions .24 .24 .24 .24
2963 @item Name @tab Argument @tab Return type @tab Option
2964 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
2965 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
2966 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2967 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
2974 @section @code{TAN} --- Tangent function
2975 @findex @code{TAN} intrinsic
2976 @findex @code{DTAN} intrinsic
2980 @item @emph{Description}:
2981 @code{TAN(X)} computes the tangent of @var{X}.
2983 @item @emph{Option}:
2989 @item @emph{Syntax}:
2992 @item @emph{Arguments}:
2993 @multitable @columnfractions .15 .80
2994 @item @var{X} @tab The type shall be @code{REAL(*)}.
2997 @item @emph{Return value}:
2998 The return value is of type @code{REAL(*)}. The kind type parameter is
2999 the same as @var{X}.
3001 @item @emph{Example}:
3004 real(8) :: x = 0.165_8
3006 end program test_tan
3009 @item @emph{Specific names}:
3010 @multitable @columnfractions .24 .24 .24 .24
3011 @item Name @tab Argument @tab Return type @tab Option
3012 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
3019 @section @code{TANH} --- Hyperbolic tangent function
3020 @findex @code{TANH} intrinsic
3021 @findex @code{DTANH} intrinsic
3022 @cindex hyperbolic tangent
3025 @item @emph{Description}:
3026 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
3028 @item @emph{Option}:
3034 @item @emph{Syntax}:
3037 @item @emph{Arguments}:
3038 @multitable @columnfractions .15 .80
3039 @item @var{X} @tab The type shall be @code{REAL(*)}.
3042 @item @emph{Return value}:
3043 The return value is of type @code{REAL(*)} and lies in the range
3044 @math{ - 1 \leq tanh(x) \leq 1 }.
3046 @item @emph{Example}:
3049 real(8) :: x = 2.1_8
3051 end program test_tanh
3054 @item @emph{Specific names}:
3055 @multitable @columnfractions .24 .24 .24 .24
3056 @item Name @tab Argument @tab Return type @tab Option
3057 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
3065 @comment gen fraction
3083 @comment sub get_command
3085 @comment sub get_command_argument
3087 @comment sub get_environment_variable
3127 @comment gen len_trim
3137 @comment gen logical
3148 @comment gen maxexponent
3163 @comment gen minexponent
3177 @comment gen nearest
3188 @comment gen precision
3190 @comment gen present
3192 @comment gen product
3199 @comment sub random_number
3201 @comment sub random_seed
3211 @comment gen reshape
3213 @comment gen rrspacing
3222 @comment gen selected_int_kind
3224 @comment gen selected_real_kind
3226 @comment gen set_exponent
3236 @comment gen spacing
3250 @comment sub system_clock
3254 @comment gen transfer
3256 @comment gen transpose