Convert real to string.
use penf
print "(A)", str(fm=FR4P, n=1._R4P)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | fm | Format different from the standard for the kind. |
||
real(kind=R4P), | intent(in) | :: | n | Real to be converted. |
Returned string containing input number.
elemental function strf_R4P(fm, n) result(str)
!< Convert real to string.
!<
!<```fortran
!< use penf
!< print "(A)", str(fm=FR4P, n=1._R4P)
!<```
!=> 0.100000E+01 <<<
character(*), intent(in) :: fm !< Format different from the standard for the kind.
real(R4P), intent(in) :: n !< Real to be converted.
character(DR4P) :: str !< Returned string containing input number.
write(str, trim(fm)) n
endfunction strf_R4P