digit_I4 Function

private elemental function digit_I4(n) result(digit)

Arguments

TypeIntentOptionalAttributesName
integer(kind=I4P), intent(in) :: n

Return Value integer(kind=I4P)


Called by

proc~~digit_i4~~CalledByGraph proc~digit_i4 digit_I4 interface~digit digit interface~digit->proc~digit_i4 program~volatile_doctest~104 volatile_doctest program~volatile_doctest~104->interface~digit program~volatile_doctest~504 volatile_doctest program~volatile_doctest~504->interface~digit program~volatile_doctest~902 volatile_doctest program~volatile_doctest~902->interface~digit program~volatile_doctest~1082 volatile_doctest program~volatile_doctest~1082->interface~digit program~volatile_doctest~107 volatile_doctest program~volatile_doctest~107->interface~digit program~volatile_doctest~507 volatile_doctest program~volatile_doctest~507->interface~digit program~volatile_doctest~905 volatile_doctest program~volatile_doctest~905->interface~digit program~volatile_doctest~1077 volatile_doctest program~volatile_doctest~1077->interface~digit program~volatile_doctest~502 volatile_doctest program~volatile_doctest~502->interface~digit program~volatile_doctest~900 volatile_doctest program~volatile_doctest~900->interface~digit program~volatile_doctest~1080 volatile_doctest program~volatile_doctest~1080->interface~digit program~volatile_doctest~1256 volatile_doctest program~volatile_doctest~1256->interface~digit program~volatile_doctest~327 volatile_doctest program~volatile_doctest~327->interface~digit program~volatile_doctest~505 volatile_doctest program~volatile_doctest~505->interface~digit program~volatile_doctest~681 volatile_doctest program~volatile_doctest~681->interface~digit program~volatile_doctest~903 volatile_doctest program~volatile_doctest~903->interface~digit program~volatile_doctest~1259 volatile_doctest program~volatile_doctest~1259->interface~digit program~volatile_doctest~330 volatile_doctest program~volatile_doctest~330->interface~digit program~volatile_doctest~684 volatile_doctest program~volatile_doctest~684->interface~digit program~volatile_doctest~1254 volatile_doctest program~volatile_doctest~1254->interface~digit program~volatile_doctest~325 volatile_doctest program~volatile_doctest~325->interface~digit program~volatile_doctest~679 volatile_doctest program~volatile_doctest~679->interface~digit program~volatile_doctest~1257 volatile_doctest program~volatile_doctest~1257->interface~digit program~volatile_doctest~106 volatile_doctest program~volatile_doctest~106->interface~digit program~volatile_doctest~328 volatile_doctest program~volatile_doctest~328->interface~digit program~volatile_doctest~682 volatile_doctest program~volatile_doctest~682->interface~digit program~volatile_doctest~109 volatile_doctest program~volatile_doctest~109->interface~digit program~volatile_doctest~1079 volatile_doctest program~volatile_doctest~1079->interface~digit

Contents

Source Code


Source Code

   elemental function digit_I4(n) result(digit)
   !< Compute the number of digits in decimal base of the input integer.
   !<
   !<```fortran
   !< use penf
   !< print FI4P, digit(100_I4P)
   !<```
   !=> 3 <<<
   integer(I4P), intent(in) :: n     !< Input integer.
   character(DI4P)          :: str   !< Returned string containing input number plus padding zeros.
   integer(I4P)             :: digit !< Number of digits.

   write(str, FI4P) abs(n)        ! Casting of n to string.
   digit = len_trim(adjustl(str)) ! Calculating the digits number of n.
   endfunction digit_I4