Document AIMAG, AINT, ALL

From-SVN: r97123
This commit is contained in:
Steven G. Kargl 2005-03-28 02:52:58 +00:00 committed by Steven G. Kargl
parent 7a17ef5e63
commit 6b32f9fc29
2 changed files with 174 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2005-03-27 Steven G. Kargl <kargls@comcast.net>
* intrinsic.texi: Document AIMAG, AINT, ALL
2005-03-26 Steven G. Kargl <kargls@comcast.net>
* arith.c (check_result): Fix illogical logic.

View File

@ -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