bctor_R4P Function

private elemental function bctor_R4P(bstr, knd) result(n)

Convert bit-string to real.

 use penf
 print FR4P, bcton('00000000000000001000000000111111', knd=1._R4P)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: bstr

String containing input number.

real(kind=R4P), intent(in) :: knd

Number kind.

Return Value real(kind=R4P)

Number returned.


Called by

proc~~bctor_r4p~~CalledByGraph proc~bctor_r4p bctor_R4P interface~bcton bcton interface~bcton->proc~bctor_r4p program~volatile_doctest~118 volatile_doctest program~volatile_doctest~118->interface~bcton program~volatile_doctest~133 volatile_doctest program~volatile_doctest~133->interface~bcton program~volatile_doctest~148 volatile_doctest program~volatile_doctest~148->interface~bcton program~volatile_doctest~152 volatile_doctest program~volatile_doctest~152->interface~bcton program~volatile_doctest~190 volatile_doctest program~volatile_doctest~190->interface~bcton program~volatile_doctest~206 volatile_doctest program~volatile_doctest~206->interface~bcton program~volatile_doctest~72 volatile_doctest program~volatile_doctest~72->interface~bcton

Source Code

   elemental function bctor_R4P(bstr, knd) result(n)
   !< Convert bit-string to real.
   !<
   !<```fortran
   !< use penf
   !< print FR4P, bcton('00000000000000001000000000111111', knd=1._R4P)
   !<```
   !=> 0.100000E+01 <<<
   character(*), intent(in) :: bstr      !< String containing input number.
   real(R4P),    intent(in) :: knd       !< Number kind.
   real(R4P)                :: n         !< Number returned.
   integer(I1P)             :: buffer(4) !< Transfer buffer.

   read(bstr, '(4B8.8)') buffer
   n = transfer(buffer, n)
   endfunction bctor_R4P