bctor_R4P Function

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

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: bstr
real(kind=R4P), intent(in) :: knd

Return Value real(kind=R4P)


Called by

proc~~bctor_r4p~4~~CalledByGraph proc~bctor_r4p~4 bctor_R4P interface~bcton~4 bcton interface~bcton~4->proc~bctor_r4p~4

Contents

Source Code


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