bctor_R8P Function

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

Arguments

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

Return Value real(kind=R8P)


Called by

proc~~bctor_r8p~6~~CalledByGraph proc~bctor_r8p~6 bctor_R8P interface~bcton~6 bcton interface~bcton~6->proc~bctor_r8p~6

Contents

Source Code


Source Code

   elemental function bctor_R8P(bstr, knd) result(n)
   !< Convert bit-string to real.
   !<
   !<```fortran
   !< use penf
   !< print FR8P, bcton('0000000000000000000000000000000000000000000000001111000000111111', knd=1._R8P)
   !<```
   !=> 0.100000000000000E+001 <<<
   character(*), intent(in) :: bstr      !< String containing input number.
   real(R8P),    intent(in) :: knd       !< Number kind.
   real(R8P)                :: n         !< Number returned.
   integer(I1P)             :: buffer(8) !< Transfer buffer.

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