Specify that a function in Fortran is intrinsic

Viewed 71

Is there a way to specify that a function used (for example gamma in the program below) is an intrinsic function and not one defined by the user?

module m
end module m

program xgamma
use m
implicit none
integer, parameter :: dp = kind(1.0d0)
real(kind=dp)      :: x
integer            :: i
do i=1,11
   x = i*0.5_dp
   write (*,"(f5.1,f20.6)") x,gamma(x)
end do
end program xgamma
1 Answers

Yes, via intrinsic:

module m
end module m

program xgamma

    use m
    implicit none
    intrinsic :: gamma
    integer, parameter :: dp = kind(1.0d0)
    real(kind=dp)      :: x
    integer            :: i
    do i=1,11
       x = i*0.5_dp
       write (*,"(f5.1,f20.6)") x,gamma(x)
    end do

contains

    real function gamma()
    end function

end program xgamma
Related