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, Arccosine 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{COS}: COS, Cosine function
59 * @code{COSH}: COSH, Hyperbolic cosine function
60 * @code{ERF}: ERF, Error function
61 * @code{ERFC}: ERFC, Complementary error function
62 * @code{EXP}: EXP, Cosine function
63 * @code{LOG}: LOG, Logarithm function
64 * @code{LOG10}: LOG10, Base 10 logarithm function
65 * @code{SQRT}: SQRT, Square-root function
66 * @code{SIN}: SIN, Sine function
67 * @code{SINH}: SINH, Hyperbolic sine function
68 * @code{TAN}: TAN, Tangent function
69 * @code{TANH}: TANH, Hyperbolic tangent function
73 @section Introduction to intrinsic procedures
75 Gfortran provides a rich set of intrinsic procedures that includes all
76 the intrinsic procedures required by the Fortran 95 standard, a set of
77 intrinsic procedures for backwards compatibility with Gnu Fortran 77
78 (i.e., @command{g77}), and a small selection of intrinsic procedures
79 from the Fortran 2003 standard. Any description here, which conflicts with a
80 description in either the Fortran 95 standard or the Fortran 2003 standard,
81 is unintentional and the standard(s) should be considered authoritative.
83 The enumeration of the @code{KIND} type parameter is processor defined in
84 the Fortran 95 standard. Gfortran defines the default integer type and
85 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
86 respectively. The standard mandates that both data types shall have
87 another kind, which have more precision. On typical target architectures
88 supports by @command{gfortran}, this kind type parameter is @code{KIND=8}.
89 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
90 In the description of generic intrinsic procedures, the kind type parameter
91 will be specified by @code{KIND=*}, and in the description of specific
92 names for an intrinsic procedure the kind type parameter will be explicitly
93 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
94 brevity the optional @code{KIND=} syntax will be omitted.
96 Many of the intrinsics procedures take one or more optional arguments.
97 This document follows the convention used in the Fortran 95 standard,
98 and denotes such arguments by square brackets.
100 @command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
101 which can be used to restrict the set of intrinsic procedures to a
102 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
103 option, and so all intrinsic procedures describe here are accepted. There
104 is one caveat. For a select group of intrinsic procedures, @command{g77}
105 implemented both a function and a subroutine. Both classes
106 have been implemented in @command{gfortran} for backwards compatibility
107 with @command{g77}. It is noted here that these functions and subroutines
108 cannot be intermixed in a given subprogram. In the descriptions that follow,
109 the applicable option(s) is noted.
114 @section @code{ABORT} --- Abort the program
119 @item @emph{Description}:
120 @code{ABORT} causes immediate termination of the program. On operating
121 systems that support a core dump, @code{ABORT} will produce a core dump,
122 which is suitable for debugging purposes.
128 non-elemental subroutine
133 @item @emph{Return value}:
136 @item @emph{Example}:
139 integer :: i = 1, j = 2
140 if (i /= j) call abort
141 end program test_abort
148 @section @code{ABS} --- Absolute value
149 @findex @code{ABS} intrinsic
150 @findex @code{CABS} intrinsic
151 @findex @code{DABS} intrinsic
152 @findex @code{IABS} intrinsic
153 @findex @code{ZABS} intrinsic
154 @findex @code{CDABS} intrinsic
155 @cindex absolute value
158 @item @emph{Description}:
159 @code{ABS(X)} computes the absolute value of @code{X}.
170 @item @emph{Arguments}:
171 @multitable @columnfractions .15 .80
172 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
173 @code{REAL(*)}, or @code{COMPLEX(*)}.
176 @item @emph{Return value}:
177 The return value is of the same type and
178 kind as the argument except the return value is @code{REAL(*)} for a
179 @code{COMPLEX(*)} argument.
181 @item @emph{Example}:
186 complex :: z = (-1.e0,0.e0)
193 @item @emph{Specific names}:
194 @multitable @columnfractions .24 .24 .24 .24
195 @item Name @tab Argument @tab Return type @tab Option
196 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab f95, gnu
197 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
198 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu
199 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
200 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
207 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
208 @findex @code{ACHAR} intrinsic
209 @cindex @acronym{ASCII} collating sequence
212 @item @emph{Description}:
213 @code{ACHAR(I)} returns the character located at position @code{I}
214 in the @acronym{ASCII} collating sequence.
225 @item @emph{Arguments}:
226 @multitable @columnfractions .15 .80
227 @item @var{I} @tab The type shall be an @code{INTEGER(*)}.
230 @item @emph{Return value}:
231 The return value is of type @code{CHARACTER} with a length of one. The
232 kind type parameter is the same as @code{KIND('A')}.
234 @item @emph{Example}:
239 end program test_achar
246 @section @code{ACOS} --- Arccosine function
247 @findex @code{ACOS} intrinsic
248 @findex @code{DACOS} intrinsic
252 @item @emph{Description}:
253 @code{ACOS(X)} computes the arccosine of its @var{X}.
264 @item @emph{Arguments}:
265 @multitable @columnfractions .15 .80
266 @item @var{X} @tab The type shall be an @code{REAL(*)}, and a magnitude that is
270 @item @emph{Return value}:
271 The return value is of type @code{REAL(*)} and it lies in the
272 range @math{ 0 \leq \arccos (x) \leq \pi}. The kind type
273 parameter is the same as @var{X}.
275 @item @emph{Example}:
278 real(8) :: x = 0.866_8
280 end program test_acos
283 @item @emph{Specific names}:
284 @multitable @columnfractions .24 .24 .24 .24
285 @item Name @tab Argument @tab Return type @tab Option
286 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
293 @section @code{ADJUSTL} --- Left adjust a string
294 @findex @code{ADJUSTL} intrinsic
295 @cindex adjust string
298 @item @emph{Description}:
299 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
300 Spaces are inserted at the end of the string as needed.
309 @code{STR = ADJUSTL(STR)}
311 @item @emph{Arguments}:
312 @multitable @columnfractions .15 .80
313 @item @var{STR} @tab The type shall be @code{CHARACTER}.
316 @item @emph{Return value}:
317 The return value is of type @code{CHARACTER} where leading spaces
318 are removed and the same number of spaces are inserted on the end
321 @item @emph{Example}:
324 character(len=20) :: str = ' gfortran'
327 end program test_adjustl
333 @section @code{ADJUSTR} --- Right adjust a string
334 @findex @code{ADJUSTR} intrinsic
335 @cindex adjust string
338 @item @emph{Description}:
339 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
340 Spaces are inserted at the start of the string as needed.
349 @code{STR = ADJUSTR(STR)}
351 @item @emph{Arguments}:
352 @multitable @columnfractions .15 .80
353 @item @var{STR} @tab The type shall be @code{CHARACTER}.
356 @item @emph{Return value}:
357 The return value is of type @code{CHARACTER} where trailing spaces
358 are removed and the same number of spaces are inserted at the start
361 @item @emph{Example}:
364 character(len=20) :: str = 'gfortran'
367 end program test_adjustr
373 @section @code{AIMAG} --- Imaginary part of complex number
374 @findex @code{AIMAG} intrinsic
375 @findex @code{DIMAG} intrinsic
376 @cindex Imaginary part
379 @item @emph{Description}:
380 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
391 @item @emph{Arguments}:
392 @multitable @columnfractions .15 .80
393 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
396 @item @emph{Return value}:
397 The return value is of type real with the
398 kind type parameter of the argument.
400 @item @emph{Example}:
405 z4 = cmplx(1.e0_4, 0.e0_4)
406 z8 = cmplx(0.e0_8, 1.e0_8)
407 print *, aimag(z4), dimag(z8)
408 end program test_aimag
411 @item @emph{Specific names}:
412 @multitable @columnfractions .24 .24 .24 .24
413 @item Name @tab Argument @tab Return type @tab Option
414 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab f95, gnu
420 @section @code{AINT} --- Imaginary part of complex number
421 @findex @code{AINT} intrinsic
422 @findex @code{DINT} intrinsic
426 @item @emph{Description}:
427 @code{AINT(X [, KIND])} truncates its argument to a whole number.
436 @code{X = AINT(X)} @*
437 @code{X = AINT(X, KIND)}
439 @item @emph{Arguments}:
440 @multitable @columnfractions .15 .80
441 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
442 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
443 initialization expression.
446 @item @emph{Return value}:
447 The return value is of type real with the kind type parameter of the
448 argument if the optional @var{KIND} is absence; otherwise, the kind
449 type parameter will be given by @var{KIND}. If the magnitude of
450 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
451 magnitude is equal to or greater than one, then it returns the largest
452 whole number that does not exceed its magnitude. The sign is the same
453 as the sign of @var{X}.
455 @item @emph{Example}:
462 print *, aint(x4), dint(x8)
464 end program test_aint
467 @item @emph{Specific names}:
468 @multitable @columnfractions .24 .24 .24 .24
469 @item Name @tab Argument @tab Return type @tab Option
470 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
476 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
477 @findex @code{ALL} intrinsic
481 @item @emph{Description}:
482 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
483 in the array along dimension @var{DIM}.
489 transformational function
492 @code{L = ALL(MASK)} @*
493 @code{L = ALL(MASK, DIM)}
495 @item @emph{Arguments}:
496 @multitable @columnfractions .15 .80
497 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
498 it shall not be scalar.
499 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
500 with a value that lies between one and the rank of @var{MASK}.
503 @item @emph{Return value}:
504 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
505 the kind type parameter is the same as the kind type parameter of
506 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
507 an array with the rank of @var{MASK} minus 1. The shape is determined from
508 the shape of @var{MASK} where the @var{DIM} dimension is elided.
512 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
513 It also is true if @var{MASK} has zero size; otherwise, it is false.
515 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
516 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
517 is determined by applying @code{ALL} to the array sections.
520 @item @emph{Example}:
524 l = all((/.true., .true., .true./))
529 integer a(2,3), b(2,3)
533 print *, all(a .eq. b, 1)
534 print *, all(a .eq. b, 2)
535 end subroutine section
543 @section @code{ALLOCATED} --- Status of an allocatable entity
544 @findex @code{ALLOCATED} intrinsic
545 @cindex allocation status
548 @item @emph{Description}:
549 @code{ALLOCATED(X)} checks the status of wether @var{X} is allocated.
558 @code{L = ALLOCATED(X)}
560 @item @emph{Arguments}:
561 @multitable @columnfractions .15 .80
562 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
565 @item @emph{Return value}:
566 The return value is a scalar @code{LOGICAL} with the default logical
567 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
568 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
570 @item @emph{Example}:
572 program test_allocated
574 real(4), allocatable :: x(:)
575 if (allocated(x) .eqv. .false.) allocate(x(i)
576 end program test_allocated
582 @section @code{ANINT} --- Imaginary part of complex number
583 @findex @code{ANINT} intrinsic
584 @findex @code{DNINT} intrinsic
588 @item @emph{Description}:
589 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
598 @code{X = ANINT(X)} @*
599 @code{X = ANINT(X, KIND)}
601 @item @emph{Arguments}:
602 @multitable @columnfractions .15 .80
603 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
604 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
605 initialization expression.
608 @item @emph{Return value}:
609 The return value is of type real with the kind type parameter of the
610 argument if the optional @var{KIND} is absence; otherwise, the kind
611 type parameter will be given by @var{KIND}. If @var{X} is greater than
612 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
613 less than or equal to zero, then return @code{AINT(X-0.5)}.
615 @item @emph{Example}:
622 print *, anint(x4), dnint(x8)
624 end program test_anint
627 @item @emph{Specific names}:
628 @multitable @columnfractions .24 .24 .24 .24
629 @item Name @tab Argument @tab Return type @tab Option
630 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
636 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
637 @findex @code{ANY} intrinsic
641 @item @emph{Description}:
642 @code{ANY(MASK [, DIM])} determines if any of the values is true in @var{MASK}
643 in the array along dimension @var{DIM}.
649 transformational function
652 @code{L = ANY(MASK)} @*
653 @code{L = ANY(MASK, DIM)}
655 @item @emph{Arguments}:
656 @multitable @columnfractions .15 .80
657 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
658 it shall not be scalar.
659 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
660 with a value that lies between one and the rank of @var{MASK}.
663 @item @emph{Return value}:
664 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
665 the kind type parameter is the same as the kind type parameter of
666 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
667 an array with the rank of @var{MASK} minus 1. The shape is determined from
668 the shape of @var{MASK} where the @var{DIM} dimension is elided.
672 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
673 otherwise, it is false. It also is false if @var{MASK} has zero size.
675 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
676 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
677 is determined by applying @code{ANY} to the array sections.
680 @item @emph{Example}:
684 l = any((/.true., .true., .true./))
689 integer a(2,3), b(2,3)
693 print *, any(a .eq. b, 1)
694 print *, any(a .eq. b, 2)
695 end subroutine section
702 @section @code{ASIN} --- Arcsine function
703 @findex @code{ASIN} intrinsic
704 @findex @code{DASIN} intrinsic
708 @item @emph{Description}:
709 @code{ASIN(X)} computes the arcsine of its @var{X}.
720 @item @emph{Arguments}:
721 @multitable @columnfractions .15 .80
722 @item @var{X} @tab The type shall be an @code{REAL(*)}, and a magnitude that is
726 @item @emph{Return value}:
727 The return value is of type @code{REAL(*)} and it lies in the
728 range @math{-\pi / 2 \leq \arccos (x) \leq \pi / 2}. The kind type
729 parameter is the same as @var{X}.
731 @item @emph{Example}:
734 real(8) :: x = 0.866_8
736 end program test_asin
739 @item @emph{Specific names}:
740 @multitable @columnfractions .24 .24 .24 .24
741 @item Name @tab Argument @tab Return type @tab Option
742 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
748 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
749 @findex @code{ASSOCIATED} intrinsic
750 @cindex pointer status
753 @item @emph{Description}:
754 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
755 or if @var{PTR} is associated with the target @var{TGT}.
764 @code{L = ASSOCIATED(PTR)} @*
765 @code{L = ASSOCIATED(PTR [, TGT])}
767 @item @emph{Arguments}:
768 @multitable @columnfractions .15 .80
769 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
770 it can be of any type.
771 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
772 a @code{TARGET}. It must have the same type, kind type parameter, and
773 array rank as @var{PTR}.
775 The status of neither @var{PTR} nor @var{TGT} can be undefined.
777 @item @emph{Return value}:
778 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
779 There are several cases:
781 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
782 is true if @var{PTR} is associated with a target; otherwise, it returns false.
783 @item (B) If @var{TGT} is present and a scalar target, the result is true if
785 is not a 0 sized storage sequence and the target associated with @var{PTR}
786 occupies the same storage units. If @var{PTR} is disassociated, then the
788 @item (C) If @var{TGT} is present and an array target, the result is true if
789 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
790 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
791 @var{PTR} occupy the same storage units in array element order.
792 As in case(B), the result is false, if @var{PTR} is disassociated.
793 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
794 target associated with @var{PTR} and the target associated with @var{TGT}
795 are not 0 sized storage sequences and occupy the same storage units.
796 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
797 @item (E) If @var{TGT} is present and an array pointer, the result is true if
798 target associated with @var{PTR} and the target associated with @var{TGT}
799 have the same shape, are not 0 sized arrays, are arrays whose elements are
800 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
801 storage units in array element order.
802 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
805 @item @emph{Example}:
807 program test_associated
809 real, target :: tgt(2) = (/1., 2./)
810 real, pointer :: ptr(:)
812 if (associated(ptr) .eqv. .false.) call abort
813 if (associated(ptr,tgt) .eqv. .false.) call abort
814 end program test_associated
820 @section @code{ATAN} --- Arctangent function
821 @findex @code{ATAN} intrinsic
822 @findex @code{DATAN} intrinsic
826 @item @emph{Description}:
827 @code{ATAN(X)} computes the arctangent of @var{X}.
838 @item @emph{Arguments}:
839 @multitable @columnfractions .15 .80
840 @item @var{X} @tab The type shall be an @code{REAL(*)}.
843 @item @emph{Return value}:
844 The return value is of type @code{REAL(*)} and it lies in the
845 range @math{ - \pi / 2 \leq \arcsin (x) \leq \pi / 2}.
847 @item @emph{Example}:
850 real(8) :: x = 2.866_8
852 end program test_atan
855 @item @emph{Specific names}:
856 @multitable @columnfractions .24 .24 .24 .24
857 @item Name @tab Argument @tab Return type @tab Option
858 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
864 @section @code{ATAN2} --- Arctangent function
865 @findex @code{ATAN2} intrinsic
866 @findex @code{DATAN2} intrinsic
870 @item @emph{Description}:
871 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
880 @code{X = ATAN2(Y,X)}
882 @item @emph{Arguments}:
883 @multitable @columnfractions .15 .80
884 @item @var{Y} @tab The type shall be @code{REAL(*)}.
885 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
886 If @var{Y} is zero, then @var{X} must be nonzero.
889 @item @emph{Return value}:
890 The return value has the same type and kind type parameter as @var{Y}.
891 It is the principle value of the complex number @math{X + i Y}. If
892 @var{X} is nonzero, then it lies in the range @math{-\pi \le \arccos (x) \leq \pi}.
893 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
894 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
895 is negative. Finally, if @var{X} is zero, then the magnitude of the result
898 @item @emph{Example}:
901 real(4) :: x = 1.e0_4, y = 0.5e0_4
903 end program test_atan2
906 @item @emph{Specific names}:
907 @multitable @columnfractions .24 .24 .24 .24
908 @item Name @tab Argument @tab Return type @tab Option
909 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
915 @section @code{BESJ0} --- Bessel function of the first kind of order 0
916 @findex @code{BESJ0} intrinsic
917 @findex @code{DBESJ0} intrinsic
921 @item @emph{Description}:
922 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
934 @item @emph{Arguments}:
935 @multitable @columnfractions .15 .80
936 @item @var{X} @tab The type shall be an @code{REAL(*)}, and it shall be scalar.
939 @item @emph{Return value}:
940 The return value is of type @code{REAL(*)} and it lies in the
941 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
943 @item @emph{Example}:
948 end program test_besj0
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{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
961 @section @code{BESJ1} --- Bessel function of the first kind of order 1
962 @findex @code{BESJ1} intrinsic
963 @findex @code{DBESJ1} intrinsic
967 @item @emph{Description}:
968 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
980 @item @emph{Arguments}:
981 @multitable @columnfractions .15 .80
982 @item @var{X} @tab The type shall be an @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.5818... \leq Bessel (0,x) \leq 0.5818 }.
989 @item @emph{Example}:
994 end program test_besj1
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{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1007 @section @code{BESJN} --- Bessel function of the first kind
1008 @findex @code{BESJN} intrinsic
1009 @findex @code{DBESJN} intrinsic
1013 @item @emph{Description}:
1014 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1017 @item @emph{Option}:
1023 @item @emph{Syntax}:
1024 @code{Y = BESJN(N, X)}
1026 @item @emph{Arguments}:
1027 @multitable @columnfractions .15 .80
1028 @item @var{N} @tab The type shall be an @code{INTEGER(*)}, and it shall be scalar.
1029 @item @var{X} @tab The type shall be an @code{REAL(*)}, and it shall be scalar.
1032 @item @emph{Return value}:
1033 The return value is a scalar of type @code{REAL(*)}.
1035 @item @emph{Example}:
1038 real(8) :: x = 1.0_8
1040 end program test_besjn
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{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1047 @item @tab @code{REAL(8) X} @tab @tab
1054 @section @code{BESY0} --- Bessel function of the second kind of order 0
1055 @findex @code{BESY0} intrinsic
1056 @findex @code{DBESY0} intrinsic
1060 @item @emph{Description}:
1061 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1064 @item @emph{Option}:
1070 @item @emph{Syntax}:
1073 @item @emph{Arguments}:
1074 @multitable @columnfractions .15 .80
1075 @item @var{X} @tab The type shall be an @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 = 0.0_8
1086 end program test_besy0
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{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1099 @section @code{BESY1} --- Bessel function of the second kind of order 1
1100 @findex @code{BESY1} intrinsic
1101 @findex @code{DBESY1} intrinsic
1105 @item @emph{Description}:
1106 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1109 @item @emph{Option}:
1115 @item @emph{Syntax}:
1118 @item @emph{Arguments}:
1119 @multitable @columnfractions .15 .80
1120 @item @var{X} @tab The type shall be an @code{REAL(*)}, and it shall be scalar.
1123 @item @emph{Return value}:
1124 The return value is a scalar of type @code{REAL(*)}.
1126 @item @emph{Example}:
1129 real(8) :: x = 1.0_8
1131 end program test_besy1
1134 @item @emph{Specific names}:
1135 @multitable @columnfractions .24 .24 .24 .24
1136 @item Name @tab Argument @tab Return type @tab Option
1137 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1144 @section @code{BESYN} --- Bessel function of the second kind
1145 @findex @code{BESYN} intrinsic
1146 @findex @code{DBESYN} intrinsic
1150 @item @emph{Description}:
1151 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1154 @item @emph{Option}:
1160 @item @emph{Syntax}:
1161 @code{Y = BESYN(N, X)}
1163 @item @emph{Arguments}:
1164 @multitable @columnfractions .15 .80
1165 @item @var{N} @tab The type shall be an @code{INTEGER(*)}, and it shall be scalar.
1166 @item @var{X} @tab The type shall be an @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_besyn
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{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab gnu
1184 @item @tab @code{REAL(8) X} @tab @tab
1190 @section @code{COS} --- Cosine function
1191 @findex @code{COS} intrinsic
1192 @findex @code{DCOS} intrinsic
1193 @findex @code{ZCOS} intrinsic
1194 @findex @code{CDCOS} intrinsic
1198 @item @emph{Description}:
1199 @code{COS(X)} computes the cosine of @var{X}.
1201 @item @emph{Option}:
1207 @item @emph{Syntax}:
1210 @item @emph{Arguments}:
1211 @multitable @columnfractions .15 .80
1212 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1216 @item @emph{Return value}:
1217 The return value has same type and kind than @var{X}.
1219 @item @emph{Example}:
1224 end program test_cos
1227 @item @emph{Specific names}:
1228 @multitable @columnfractions .24 .24 .24 .24
1229 @item Name @tab Argument @tab Return type @tab Option
1230 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1231 @item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
1232 @item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1233 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1239 @section @code{COSH} --- Hyperbolic cosine function
1240 @findex @code{COSH} intrinsic
1241 @findex @code{DCOSH} intrinsic
1242 @cindex hyperbolic cosine
1245 @item @emph{Description}:
1246 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
1248 @item @emph{Option}:
1254 @item @emph{Syntax}:
1257 @item @emph{Arguments}:
1258 @multitable @columnfractions .15 .80
1259 @item @var{X} @tab The type shall be an @code{REAL(*)}.
1262 @item @emph{Return value}:
1263 The return value is of type @code{REAL(*)} and it is positive
1264 (@math{ \cosh (x) \geq 0 }.
1266 @item @emph{Example}:
1269 real(8) :: x = 1.0_8
1271 end program test_cosh
1274 @item @emph{Specific names}:
1275 @multitable @columnfractions .24 .24 .24 .24
1276 @item Name @tab Argument @tab Return type @tab Option
1277 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1283 @section @code{ERF} --- Error function
1284 @findex @code{ERF} intrinsic
1285 @cindex error function
1288 @item @emph{Description}:
1289 @code{ERF(X)} computes the error function of @var{X}.
1291 @item @emph{Option}:
1297 @item @emph{Syntax}:
1300 @item @emph{Arguments}:
1301 @multitable @columnfractions .15 .80
1302 @item @var{X} @tab The type shall be an @code{REAL(*)}, and it shall be scalar.
1305 @item @emph{Return value}:
1306 The return value is a scalar of type @code{REAL(*)} and it is positive
1307 (@math{ - 1 \leq erf (x) \leq 1 }.
1309 @item @emph{Example}:
1312 real(8) :: x = 0.17_8
1314 end program test_erf
1317 @item @emph{Specific names}:
1318 @multitable @columnfractions .24 .24 .24 .24
1319 @item Name @tab Argument @tab Return type @tab Option
1320 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1327 @section @code{ERFC} --- Error function
1328 @findex @code{ERFC} intrinsic
1329 @cindex error function
1332 @item @emph{Description}:
1333 @code{ERFC(X)} computes the complementary error function of @var{X}.
1335 @item @emph{Option}:
1341 @item @emph{Syntax}:
1344 @item @emph{Arguments}:
1345 @multitable @columnfractions .15 .80
1346 @item @var{X} @tab The type shall be an @code{REAL(*)}, and it shall be scalar.
1349 @item @emph{Return value}:
1350 The return value is a scalar of type @code{REAL(*)} and it is positive
1351 (@math{ 0 \leq erfc (x) \leq 2 }.
1353 @item @emph{Example}:
1356 real(8) :: x = 0.17_8
1358 end program test_erfc
1361 @item @emph{Specific names}:
1362 @multitable @columnfractions .24 .24 .24 .24
1363 @item Name @tab Argument @tab Return type @tab Option
1364 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab gnu
1371 @section @code{EXP} --- Exponential function
1372 @findex @code{EXP} intrinsic
1373 @findex @code{DEXP} intrinsic
1374 @findex @code{ZEXP} intrinsic
1375 @findex @code{CDEXP} intrinsic
1379 @item @emph{Description}:
1380 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
1382 @item @emph{Option}:
1388 @item @emph{Syntax}:
1391 @item @emph{Arguments}:
1392 @multitable @columnfractions .15 .80
1393 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1397 @item @emph{Return value}:
1398 The return value has same type and kind than @var{X}.
1400 @item @emph{Example}:
1405 end program test_exp
1408 @item @emph{Specific names}:
1409 @multitable @columnfractions .24 .24 .24 .24
1410 @item Name @tab Argument @tab Return type @tab Option
1411 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1412 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
1413 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1414 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1420 @section @code{LOG} --- Logarithm function
1421 @findex @code{LOG} intrinsic
1422 @findex @code{ALOG} intrinsic
1423 @findex @code{DLOG} intrinsic
1424 @findex @code{CLOG} intrinsic
1425 @findex @code{ZLOG} intrinsic
1426 @findex @code{CDLOG} intrinsic
1430 @item @emph{Description}:
1431 @code{LOG(X)} computes the logarithm of @var{X}.
1433 @item @emph{Option}:
1439 @item @emph{Syntax}:
1442 @item @emph{Arguments}:
1443 @multitable @columnfractions .15 .80
1444 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1448 @item @emph{Return value}:
1449 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
1450 The kind type parameter is the same as @var{X}.
1452 @item @emph{Example}:
1455 real(8) :: x = 1.0_8
1456 complex :: z = (1.0, 2.0)
1459 end program test_log
1462 @item @emph{Specific names}:
1463 @multitable @columnfractions .24 .24 .24 .24
1464 @item Name @tab Argument @tab Return type @tab Option
1465 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
1466 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1467 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
1468 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1469 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1476 @section @code{LOG10} --- Base 10 logarithm function
1477 @findex @code{LOG10} intrinsic
1478 @findex @code{ALOG10} intrinsic
1479 @findex @code{DLOG10} intrinsic
1483 @item @emph{Description}:
1484 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
1486 @item @emph{Option}:
1492 @item @emph{Syntax}:
1495 @item @emph{Arguments}:
1496 @multitable @columnfractions .15 .80
1497 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1501 @item @emph{Return value}:
1502 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
1503 The kind type parameter is the same as @var{X}.
1505 @item @emph{Example}:
1508 real(8) :: x = 10.0_8
1510 end program test_log10
1513 @item @emph{Specific names}:
1514 @multitable @columnfractions .24 .24 .24 .24
1515 @item Name @tab Argument @tab Return type @tab Option
1516 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
1517 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1524 @section @code{SIN} --- Sine function
1525 @findex @code{SIN} intrinsic
1526 @findex @code{DSIN} intrinsic
1527 @findex @code{ZSIN} intrinsic
1528 @findex @code{CDSIN} intrinsic
1532 @item @emph{Description}:
1533 @code{SIN(X)} computes the sine of @var{X}.
1535 @item @emph{Option}:
1541 @item @emph{Syntax}:
1544 @item @emph{Arguments}:
1545 @multitable @columnfractions .15 .80
1546 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1550 @item @emph{Return value}:
1551 The return value has same type and king than @var{X}.
1553 @item @emph{Example}:
1558 end program test_sin
1561 @item @emph{Specific names}:
1562 @multitable @columnfractions .24 .24 .24 .24
1563 @item Name @tab Argument @tab Return type @tab Option
1564 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1565 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
1566 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1567 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1575 @section @code{SINH} --- Hyperbolic sine function
1576 @findex @code{SINH} intrinsic
1577 @findex @code{DSINH} intrinsic
1578 @cindex hyperbolic sine
1581 @item @emph{Description}:
1582 @code{SINH(X)} computes the hyperbolic sine 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 an @code{REAL(*)}.
1598 @item @emph{Return value}:
1599 The return value is of type @code{REAL(*)}.
1601 @item @emph{Example}:
1604 real(8) :: x = - 1.0_8
1606 end program test_sinh
1609 @item @emph{Specific names}:
1610 @multitable @columnfractions .24 .24 .24 .24
1611 @item Name @tab Argument @tab Return type @tab Option
1612 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1619 @section @code{SQRT} --- Square-root function
1620 @findex @code{SQRT} intrinsic
1621 @findex @code{DSQRT} intrinsic
1622 @findex @code{CSQRT} intrinsic
1623 @findex @code{ZSQRT} intrinsic
1624 @findex @code{CDSQRT} intrinsic
1628 @item @emph{Description}:
1629 @code{SQRT(X)} computes the square root of @var{X}.
1631 @item @emph{Option}:
1637 @item @emph{Syntax}:
1640 @item @emph{Arguments}:
1641 @multitable @columnfractions .15 .80
1642 @item @var{X} @tab The type shall be an @code{REAL(*)} or
1646 @item @emph{Return value}:
1647 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
1648 The kind type parameter is the same as @var{X}.
1650 @item @emph{Example}:
1653 real(8) :: x = 2.0_8
1654 complex :: z = (1.0, 2.0)
1657 end program test_sqrt
1660 @item @emph{Specific names}:
1661 @multitable @columnfractions .24 .24 .24 .24
1662 @item Name @tab Argument @tab Return type @tab Option
1663 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1664 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
1665 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1666 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
1673 @section @code{TAN} --- Tangent function
1674 @findex @code{TAN} intrinsic
1675 @findex @code{DTAN} intrinsic
1679 @item @emph{Description}:
1680 @code{TAN(X)} computes the tangent of @var{X}.
1682 @item @emph{Option}:
1688 @item @emph{Syntax}:
1691 @item @emph{Arguments}:
1692 @multitable @columnfractions .15 .80
1693 @item @var{X} @tab The type shall be an @code{REAL(*)}.
1696 @item @emph{Return value}:
1697 The return value is of type @code{REAL(*)}. The kind type parameter is
1698 the same as @var{X}.
1700 @item @emph{Example}:
1703 real(8) :: x = 0.165_8
1705 end program test_tan
1708 @item @emph{Specific names}:
1709 @multitable @columnfractions .24 .24 .24 .24
1710 @item Name @tab Argument @tab Return type @tab Option
1711 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1717 @section @code{TANH} --- Hyperbolic tangent function
1718 @findex @code{TANH} intrinsic
1719 @findex @code{DTANH} intrinsic
1720 @cindex hyperbolic tangent
1723 @item @emph{Description}:
1724 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
1726 @item @emph{Option}:
1732 @item @emph{Syntax}:
1735 @item @emph{Arguments}:
1736 @multitable @columnfractions .15 .80
1737 @item @var{X} @tab The type shall be an @code{REAL(*)}.
1740 @item @emph{Return value}:
1741 The return value is of type @code{REAL(*)} and lies in the range
1742 @math{ - 1 \leq tanh(x) \leq 1 }.
1744 @item @emph{Example}:
1747 real(8) :: x = 2.1_8
1749 end program test_tanh
1752 @item @emph{Specific names}:
1753 @multitable @columnfractions .24 .24 .24 .24
1754 @item Name @tab Argument @tab Return type @tab Option
1755 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
1763 @comment gen bit_size
1767 @comment gen ceiling
1773 @comment gen command_argument_count
1780 @comment sub cpu_time
1784 @comment sub date_and_time
1797 @comment gen dot_product
1805 @comment gen eoshift
1807 @comment gen epsilon
1814 @comment gen exponent
1822 @comment gen fraction
1840 @comment sub get_command
1842 @comment sub get_command_argument
1844 @comment sub get_environment_variable
1884 @comment gen len_trim
1894 @comment gen logical
1905 @comment gen maxexponent
1920 @comment gen minexponent
1934 @comment gen nearest
1945 @comment gen precision
1947 @comment gen present
1949 @comment gen product
1956 @comment sub random_number
1958 @comment sub random_seed
1968 @comment gen reshape
1970 @comment gen rrspacing
1979 @comment gen selected_int_kind
1981 @comment gen selected_real_kind
1983 @comment gen set_exponent
1993 @comment gen spacing
2007 @comment sub system_clock
2011 @comment gen transfer
2013 @comment gen transpose