📄 intrinsic.texi
字号:
@code{BESYN(N, X)} computes the Bessel function of the second kind of order@var{N} of @var{X}.If both arguments are arrays, their ranks and shapes shall conform.@item @emph{Standard}:GNU extension@item @emph{Class}:Elemental function@item @emph{Syntax}:@code{RESULT = BESYN(N, X)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{N} @tab Shall be a scalar or an array of type @code{INTEGER(*)}.@item @var{X} @tab Shall be a scalar or an array of type @code{REAL(*)}.@end multitable@item @emph{Return value}:The return value is a scalar of type @code{REAL(*)}.@item @emph{Example}:@smallexampleprogram test_besyn real(8) :: x = 1.0_8 x = besyn(5,x)end program test_besyn@end smallexample@item @emph{Specific names}:@multitable @columnfractions .20 .20 .20 .25@item Name @tab Argument @tab Return type @tab Standard@item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension@item @tab @code{REAL(8) X} @tab @tab @end multitable@end table@node BIT_SIZE@section @code{BIT_SIZE} --- Bit size inquiry function@fnindex BIT_SIZE@cindex bits, number of@cindex size of a variable, in bits@table @asis@item @emph{Description}:@code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)represented by the type of @var{I}.@item @emph{Standard}:F95 and later@item @emph{Class}:Inquiry function@item @emph{Syntax}:@code{RESULT = BIT_SIZE(I)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{I} @tab The type shall be @code{INTEGER(*)}.@end multitable@item @emph{Return value}:The return value is of type @code{INTEGER(*)}@item @emph{Example}:@smallexampleprogram test_bit_size integer :: i = 123 integer :: size size = bit_size(i) print *, sizeend program test_bit_size@end smallexample@end table@node BTEST@section @code{BTEST} --- Bit test function@fnindex BTEST@cindex bits, testing@table @asis@item @emph{Description}:@code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}in @var{I} is set.@item @emph{Standard}:F95 and later@item @emph{Class}:Elemental function@item @emph{Syntax}:@code{RESULT = BTEST(I, POS)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{I} @tab The type shall be @code{INTEGER(*)}.@item @var{POS} @tab The type shall be @code{INTEGER(*)}.@end multitable@item @emph{Return value}:The return value is of type @code{LOGICAL}@item @emph{Example}:@smallexampleprogram test_btest integer :: i = 32768 + 1024 + 64 integer :: pos logical :: bool do pos=0,16 bool = btest(i, pos) print *, pos, bool end doend program test_btest@end smallexample@end table@node C_ASSOCIATED@section @code{C_ASSOCIATED} --- Status of a C pointer@fnindex C_ASSOCIATED@cindex association status, C pointer@cindex pointer, C association status@table @asis@item @emph{Description}:@code{C_ASSOICATED(c_prt1[, c_ptr2])} determines the status of the C pointer @var{c_ptr1}or if @var{c_ptr1} is associated with the target @var{c_ptr2}.@item @emph{Standard}:F2003 and later@item @emph{Class}:Inquiry function@item @emph{Syntax}:@code{RESULT = C_ASSOICATED(c_prt1[, c_ptr2])}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{c_ptr1} @tab Scalar of the type @code{C_PTR} or @code{C_FUNPTR}.@item @var{c_ptr2} @tab (Optional) Scalar of the same type as @var{c_ptr1}.@end multitable@item @emph{Return value}:The return value is of type @code{LOGICAL}; it is @code{.false.} if either@var{c_ptr1} is a C NULL pointer or if @var{c_ptr1} and @var{c_ptr2}point to different addresses.@item @emph{Example}:@smallexamplesubroutine association_test(a,b) use iso_c_binding, only: c_associated, c_loc, c_ptr implicit none real, pointer :: a type(c_ptr) :: b if(c_associated(b, c_loc(a))) & stop 'b and a do not point to same target'end subroutine association_test@end smallexample@item @emph{See also}:@ref{C_LOC}, @ref{C_FUNLOC}@end table@node C_FUNLOC@section @code{C_FUNLOC} --- Obtain the C address of a procedure@fnindex C_FUNLOC@cindex pointer, C address of procedures@table @asis@item @emph{Description}:@code{C_FUNLOC(x)} determines the C address of the argument.@item @emph{Standard}:F2003 and later@item @emph{Class}:Inquiry function@item @emph{Syntax}:@code{RESULT = C_FUNLOC(x)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{x} @tab Interoperable function or pointer to such function.@end multitable@item @emph{Return value}:The return value is of type @code{C_FUNPTR} and contains the C addressof the argument.@item @emph{Example}:@smallexamplemodule x use iso_c_binding implicit nonecontains subroutine sub(a) bind(c) real(c_float) :: a a = sqrt(a)+5.0 end subroutine subend module xprogram main use iso_c_binding use x implicit none interface subroutine my_routine(p) bind(c,name='myC_func') import :: c_funptr type(c_funptr), intent(in) :: p end subroutine end interface call my_routine(c_funloc(sub))end program main@end smallexample@item @emph{See also}:@ref{C_ASSOCIATED}, @ref{C_LOC}, @ref{C_F_POINTER}, @ref{C_F_PROCPOINTER}@end table@node C_F_PROCPOINTER@section @code{C_F_PROCPOINTER} --- Convert C into Fortran procedure pointer@fnindex C_F_PROCPOINTER@cindex pointer, C address of pointers@table @asis@item @emph{Description}:@code{C_F_PROCPOINTER(cptr, fptr)} Assign the target of the C function pointer@var{cptr} to the Fortran procedure pointer @var{fptr}.Note: Due to the currently lacking support of procedure pointers in GNU Fortranthis function is not fully operable.@item @emph{Standard}:F2003 and later@item @emph{Class}:Subroutine@item @emph{Syntax}:@code{CALL C_F_PROCPOINTER(cptr, fptr)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{cptr} @tab scalar of the type @code{C_FUNPTR}. It is @code{INTENT(IN)}.@item @var{fptr} @tab procedure pointer interoperable with @var{cptr}. It is @code{INTENT(OUT)}.@end multitable@item @emph{Example}:@smallexampleprogram main use iso_c_binding implicit none abstract interface function func(a) import :: c_float real(c_float), intent(in) :: a real(c_float) :: func end function end interface interface function getIterFunc() bind(c,name="getIterFunc") import :: c_funptr type(c_funptr) :: getIterFunc end function end interface type(c_funptr) :: cfunptr procedure(func), pointer :: myFunc cfunptr = getIterFunc() call c_f_procpointer(cfunptr, myFunc)end program main@end smallexample@item @emph{See also}:@ref{C_LOC}, @ref{C_F_POINTER}@end table@node C_F_POINTER@section @code{C_F_POINTER} --- Convert C into Fortran pointer@fnindex C_F_POINTER@cindex pointer, convert C to Fortran@table @asis@item @emph{Description}:@code{C_F_POINTER(cptr, fptr[, shape])} Assign the target the C pointer@var{cptr} to the Fortran pointer @var{fptr} and specify itsshape.@item @emph{Standard}:F2003 and later@item @emph{Class}:Subroutine@item @emph{Syntax}:@code{CALL C_F_POINTER(cptr, fptr[, shape])}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{cptr} @tab scalar of the type @code{C_PTR}. It is @code{INTENT(IN)}.@item @var{fptr} @tab pointer interoperable with @var{cptr}. It is @code{INTENT(OUT)}.@item @var{shape} @tab (Optional) Rank-one array of type @code{INTEGER} with @code{INTENT(IN)}. It shall be present if and only if @var{fptr} is an array. The size must be equal to the rank of @var{fptr}.@end multitable@item @emph{Example}:@smallexampleprogram main use iso_c_binding implicit none interface subroutine my_routine(p) bind(c,name='myC_func') import :: c_ptr type(c_ptr), intent(out) :: p end subroutine end interface type(c_ptr) :: cptr real,pointer :: a(:) call my_routine(cptr) call c_f_pointer(cptr, a, [12])end program main@end smallexample@item @emph{See also}:@ref{C_LOC}, @ref{C_F_PROCPOINTER}@end table@node C_LOC@section @code{C_LOC} --- Obtain the C address of an object@fnindex C_LOC@cindex procedure pointer, convert C to Fortran@table @asis@item @emph{Description}:@code{C_LOC(x)} determines the C address of the argument.@item @emph{Standard}:F2003 and later@item @emph{Class}:Inquiry function@item @emph{Syntax}:@code{RESULT = C_LOC(x)}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{x} @tab Associated scalar pointer or interoperable scalar or allocated allocatable variable with @code{TARGET} attribute.@end multitable@item @emph{Return value}:The return value is of type @code{C_PTR} and contains the C addressof the argument.@item @emph{Example}:@smallexamplesubroutine association_test(a,b) use iso_c_binding, only: c_associated, c_loc, c_ptr implicit none real, pointer :: a type(c_ptr) :: b if(c_associated(b, c_loc(a))) & stop 'b and a do not point to same target'end subroutine association_test@end smallexample@item @emph{See also}:@ref{C_ASSOCIATED}, @ref{C_FUNLOC}, @ref{C_F_POINTER}, @ref{C_F_PROCPOINTER}@end table@node CEILING@section @code{CEILING} --- Integer ceiling function@fnindex CEILING@cindex ceiling@cindex rounding, ceiling@table @asis@item @emph{Description}:@code{CEILING(X)} returns the least integer greater than or equal to @var{X}.@item @emph{Standard}:F95 and later@item @emph{Class}:Elemental function@item @emph{Syntax}:@code{RESULT = CEILING(X [, KIND])}@item @emph{Arguments}:@multitable @columnfractions .15 .70@item @var{X} @tab The type shall be @code{REAL(*)}.@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization expression indicating the kind parameter of the result.@end multitable@item @emph{Return value}:The return value is of type @code{INTEGER(KIND)}@item @emph{Example}:@smallexampleprogram test_ceiling real :: x = 63.29 real :: y = -63.59 print *, ceiling(x) ! returns 64 print *, ceiling(y) ! returns -63end program test_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -