bctor_R8P Function

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

Convert bit-string to real.

 use penf
 print FR8P, bcton('0000000000000000000000000000000000000000000000001111000000111111', knd=1._R8P)

Arguments

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

String containing input number.

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

Number kind.

Return Value real(kind=R8P)

Number returned.


Called by

proc~~bctor_r8p~~CalledByGraph proc~bctor_r8p bctor_R8P interface~bcton bcton interface~bcton->proc~bctor_r8p 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_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