From 6b32f9fc292fb047f9dabbc7de9e49fad289f416 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Mon, 28 Mar 2005 02:52:58 +0000 Subject: [PATCH] Document AIMAG, AINT, ALL From-SVN: r97123 --- gcc/fortran/ChangeLog | 4 + gcc/fortran/intrinsic.texi | 178 +++++++++++++++++++++++++++++++++++-- 2 files changed, 174 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 04b9e40f8d2..99671746a88 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2005-03-27 Steven G. Kargl + + * intrinsic.texi: Document AIMAG, AINT, ALL + 2005-03-26 Steven G. Kargl * arith.c (check_result): Fix illogical logic. diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 9f269c5423c..61979dc7f52 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -39,6 +39,9 @@ and editing. All contributions and corrections are strongly encouraged. * @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 @end menu @node Introduction @@ -339,15 +342,174 @@ end program test_adjustr @end table +@node AIMAG +@section @code{AIMAG} --- Imaginary part of complex number +@findex @code{AIMAG} intrinsic +@findex @code{DIMAG} intrinsic +@cindex Imaginary part + +@table @asis +@item @emph{Description}: +@code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +elemental function + +@item @emph{Syntax}: +@code{X = AIMAG(Z)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .80 +@item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}. +@end multitable + +@item @emph{Return value}: +The return value is of type real with the +kind type parameter of the argument. + +@item @emph{Example}: +@smallexample +program test_aimag + complex(4) z4 + complex(8) z8 + z4 = cmplx(1.e0_4, 0.e0_4) + z8 = cmplx(0.e0_8, 1.e0_8) + print *, aimag(z4), dimag(z8) +end program test_aimag +@end smallexample + +@item @emph{Specific names}: +@multitable @columnfractions .24 .24 .24 .24 +@item Name @tab Argument @tab Return type @tab Option +@item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab f95, gnu +@end multitable +@end table + + +@node AINT +@section @code{AINT} --- Imaginary part of complex number +@findex @code{AINT} intrinsic +@findex @code{DINT} intrinsic +@cindex whole number + +@table @asis +@item @emph{Description}: +@code{AINT(X [, KIND])} truncates its argument to a whole number. + +@item @emph{Option}: +f95, gnu + +@item @emph{Type}: +elemental function + +@item @emph{Syntax}: +@code{X = AINT(X)} @* +@code{X = AINT(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 the magnitude of +@var{X} is less than one, then @code{AINT(X)} returns zero. If the +magnitude is equal to or greater than one, then it returns the largest +whole number that does not exceed its magnitude. The sign is the same +as the sign of @var{X}. + +@item @emph{Example}: +@smallexample +program test_aint + real(4) x4 + real(8) x8 + x4 = 1.234E0_4 + x8 = 4.321_8 + print *, aint(x4), dint(x8) + x8 = aint(x4,8) +end program test_aint +@end smallexample + +@item @emph{Specific names}: +@multitable @columnfractions .24 .24 .24 .24 +@item Name @tab Argument @tab Return type @tab Option +@item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu +@end multitable +@end table + + +@node ALL +@section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true + @findex @code{ALL} intrinsic +@cindex true values + +@table @asis +@item @emph{Description}: +@code{ALL(MASK [, DIM])} determines if all the values are 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 = ALL(MASK)} @* +@code{L = ALL(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{ALL(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{ALL(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{ALL(MASK)} is true if all elements of @var{MASK} are true. +It also is true if @var{MASK} has zero size; otherwise, it is false. +@item (B) +If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent +to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)} +is determined by applying @code{ALL} to the array sections. +@end table + +@item @emph{Example}: +@smallexample +program test_all + logical l + l = all((/.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 *, all(a .eq. b, 1) + print *, all(a .eq. b, 2) + end subroutine section +end program test_all +@end smallexample +@end table -@comment gen aimag -@comment dimag -@comment -@comment gen aint -@comment dint -@comment -@comment gen all -@comment @comment gen allocated @comment @comment gen anint -- 2.30.2