Convert bit-string to integer.
use penf
print FI8P, bcton('0000000000000000000000000000000000000000000000000000000000000001', knd=1_I8P)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | bstr |
String containing input number. |
||
integer(kind=I8P), | intent(in) | :: | knd |
Number kind. |
Number returned.
elemental function bctoi_I8P(bstr, knd) result(n) !< Convert bit-string to integer. !< !<```fortran !< use penf !< print FI8P, bcton('0000000000000000000000000000000000000000000000000000000000000001', knd=1_I8P) !<``` !=> 1 <<< character(*), intent(in) :: bstr !< String containing input number. integer(I8P), intent(in) :: knd !< Number kind. integer(I8P) :: n !< Number returned. read(bstr,'(B'//trim(str(bit_size(knd), .true.))//'.'//trim(str(bit_size(knd), .true.))//')') n endfunction bctoi_I8P