diff options
author | Steven G. Kargl <kargls@comcast.net> | 2005-04-03 01:20:56 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-04-03 01:20:56 +0000 |
commit | 6230d2761a4dbc7462e98412ffbf29c53911e090 (patch) | |
tree | a9183517a58e0ea1d6188386263051cac51cae8a /gcc | |
parent | 80ad92e9852a26508113712cfd98b242fc105f92 (diff) | |
download | gcc-6230d2761a4dbc7462e98412ffbf29c53911e090.zip gcc-6230d2761a4dbc7462e98412ffbf29c53911e090.tar.gz gcc-6230d2761a4dbc7462e98412ffbf29c53911e090.tar.bz2 |
Document ALLOCATED, ANINT, ANY, ASIN; Fix typos.
From-SVN: r97473
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.texi | 257 |
2 files changed, 235 insertions, 26 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4fe971a..a3ecacd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2005-04-02 Steven G. Kargl <kargls@comcast.net> + + * intrinsic.texi: Document ALLOCATED, ANINT, ANY, ASIN; fix typos + 2005-04-01 Kazu Hirata <kazu@cs.umass.edu> * decl.c, f95-lang.c, interface.c, module.c, trans-stmt.c, diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 61979dc..ed7911e 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -32,16 +32,20 @@ This portion of the document is incomplete and undergoing massive expansion and editing. All contributions and corrections are strongly encouraged. @menu -* Introduction: Introduction -* @code{ABORT}: ABORT, Abort the program -* @code{ABS}: ABS, Absolute value -* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence -* @code{ACOS}: ACOS, Arccosine function -* @code{ADJUSTL}: ADJUSTL, Left adjust a string -* @code{ADJUSTR}: ADJUSTR, Right adjust a string -* @code{AIMAG}: AIMAG, Imaginary part of complex number -* @code{AINT}: AINT, Truncate to a whole number -* @code{ALL}: ALL, Determine all values are true +* Introduction: Introduction +* @code{ABORT}: ABORT, Abort the program +* @code{ABS}: ABS, Absolute value +* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence +* @code{ACOS}: ACOS, Arccosine function +* @code{ADJUSTL}: ADJUSTL, Left adjust a string +* @code{ADJUSTR}: ADJUSTR, Right adjust a string +* @code{AIMAG}: AIMAG, Imaginary part of complex number +* @code{AINT}: AINT, Truncate to a whole number +* @code{ALL}: ALL, Determine if all values are true +* @code{ALLOCATED}: ALLOCATED, Status of allocatable entity +* @code{ANINT}: ANINT, Nearest whole number +* @code{ANY}: ANY, Determine if any values are true +* @code{ASIN}: ASIN, Arcsine function @end menu @node Introduction @@ -155,21 +159,21 @@ kind as the argument except the return value is @code{REAL(*)} for a @item @emph{Example}: @smallexample -program test_abort +program test_abs integer :: i = -1 real :: x = -1.e0 complex :: z = (-1.e0,0.e0) i = abs(i) x = abs(x) x = abs(z) -end program test_abort +end program test_abs @end smallexample @item @emph{Specific names}: @multitable @columnfractions .24 .24 .24 .24 @item Name @tab Argument @tab Return type @tab Option @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab f95, gnu -@item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu +@item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu @@ -211,7 +215,7 @@ kind type parameter is the same as @code{KIND('A')}. program test_achar character c c = achar(32) -end program test_abort +end program test_achar @end smallexample @end table @@ -238,12 +242,14 @@ elemental function @item @emph{Arguments}: @multitable @columnfractions .15 .80 -@item @var{X} @tab The type shall be an @code{REAL(*)}. +@item @var{X} @tab The type shall be an @code{REAL(*)}, and a magnitude that is +less than one. @end multitable @item @emph{Return value}: The return value is of type @code{REAL(*)} and it lies in the -range @math{ 0 \leq \arccos (x) \leq \pi}. +range @math{ 0 \leq \arccos (x) \leq \pi}. The kind type +parameter is the same as @var{X}. @item @emph{Example}: @smallexample @@ -510,16 +516,215 @@ end program test_all @end smallexample @end table -@comment gen allocated -@comment -@comment gen anint -@comment dnint -@comment -@comment gen any -@comment -@comment gen asin -@comment dasin -@comment + +@node ALLOCATED +@section @code{ALLOCATED} --- Status of an allocatable entity +@findex @code{ALLOCATED} intrinsic +@cindex allocation status + +@table @asis +@item @emph{Description}: +@code{ALLOCATED(X)} checks the status of wether @var{X} is allocated. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +inquiry function + +@item @emph{Syntax}: +@code{L = ALLOCATED(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .80 +@item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array. +@end multitable + +@item @emph{Return value}: +The return value is a scalar @code{LOGICAL} with the default logical +kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)} +is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.} + +@item @emph{Example}: +@smallexample +program test_allocated + integer :: i = 4 + real(4), allocatable :: x(:) + if (allocated(x) .eqv. .false.) allocate(x(i) +end program test_allocated +@end smallexample +@end table + + +@node ANINT +@section @code{ANINT} --- Imaginary part of complex number +@findex @code{ANINT} intrinsic +@findex @code{DNINT} intrinsic +@cindex whole number + +@table @asis +@item @emph{Description}: +@code{ANINT(X [, KIND])} rounds its argument to the nearest whole number. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +elemental function + +@item @emph{Syntax}: +@code{X = ANINT(X)} @* +@code{X = ANINT(X, KIND)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .80 +@item @var{X} @tab The type of the argument shall be @code{REAL(*)}. +@item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer +initialization expression. +@end multitable + +@item @emph{Return value}: +The return value is of type real with the kind type parameter of the +argument if the optional @var{KIND} is absence; otherwise, the kind +type parameter will be given by @var{KIND}. If @var{X} is greater than +zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is +less than or equal to zero, then return @code{AINT(X-0.5)}. + +@item @emph{Example}: +@smallexample +program test_anint + real(4) x4 + real(8) x8 + x4 = 1.234E0_4 + x8 = 4.321_8 + print *, anint(x4), dnint(x8) + x8 = anint(x4,8) +end program test_anint +@end smallexample + +@item @emph{Specific names}: +@multitable @columnfractions .24 .24 .24 .24 +@item Name @tab Argument @tab Return type @tab Option +@item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu +@end multitable +@end table + + +@node ANY +@section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true + @findex @code{ANY} intrinsic +@cindex true values + +@table @asis +@item @emph{Description}: +@code{ANY(MASK [, DIM])} determines if any of the values is true in @var{MASK} +in the array along dimension @var{DIM}. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +transformational function + +@item @emph{Syntax}: +@code{L = ANY(MASK)} @* +@code{L = ANY(MASK, DIM)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .80 +@item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and +it shall not be scalar. +@item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer +with a value that lies between one and the rank of @var{MASK}. +@end multitable + +@item @emph{Return value}: +@code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where +the kind type parameter is the same as the kind type parameter of +@var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns +an array with the rank of @var{MASK} minus 1. The shape is determined from +the shape of @var{MASK} where the @var{DIM} dimension is elided. + +@table @asis +@item (A) +@code{ANY(MASK)} is true if any element of @var{MASK} is true; +otherwise, it is false. It also is false if @var{MASK} has zero size. +@item (B) +If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent +to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)} +is determined by applying @code{ANY} to the array sections. +@end table + +@item @emph{Example}: +@smallexample +program test_any + logical l + l = any((/.true., .true., .true./)) + print *, l + call section + contains + subroutine section + integer a(2,3), b(2,3) + a = 1 + b = 1 + b(2,2) = 2 + print *, any(a .eq. b, 1) + print *, any(a .eq. b, 2) + end subroutine section +end program test_any +@end smallexample +@end table + + +@node ASIN +@section @code{ASIN} --- Arcsine function +@findex @code{ASIN} intrinsic +@findex @code{DASIN} intrinsic +@cindex arcsine + +@table @asis +@item @emph{Description}: +@code{ASIN(X)} computes the arcsine of its @var{X}. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +elemental function + +@item @emph{Syntax}: +@code{X = ASIN(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .80 +@item @var{X} @tab The type shall be an @code{REAL(*)}, and a magnitude that is +less than one. +@end multitable + +@item @emph{Return value}: +The return value is of type @code{REAL(*)} and it lies in the +range @math{ \pi / 2 \leq \arccos (x) \leq \pi / 2}. The kind type +parameter is the same as @var{X}. + +@item @emph{Example}: +@smallexample +program test_asin + real(8) :: x = 0.866_8 + x = asin(x) +end program test_asin +@end smallexample + +@item @emph{Specific names}: +@multitable @columnfractions .24 .24 .24 .24 +@item Name @tab Argument @tab Return type @tab Option +@item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu +@end multitable +@end table + + + + + @comment gen associated @comment @comment gen atan |