bstr_R8P Function

private elemental function bstr_R8P(n) result(bstr)

Convert real to string of bits.

@note Note It is assumed that R8P is represented by means of 64 bits, but this is not ensured in all architectures.

 use penf
 print "(A)", bstr(n=1._R8P)

Arguments

Type IntentOptional Attributes Name
real(kind=R8P), intent(in) :: n

Real to be converted.

Return Value character(len=64)

Returned bit-string containing input number.


Called by

proc~~bstr_r8p~~CalledByGraph proc~bstr_r8p bstr_R8P interface~bstr bstr interface~bstr->proc~bstr_r8p program~volatile_doctest~103 volatile_doctest program~volatile_doctest~103->interface~bstr program~volatile_doctest~105 volatile_doctest program~volatile_doctest~105->interface~bstr program~volatile_doctest~178 volatile_doctest program~volatile_doctest~178->interface~bstr program~volatile_doctest~201 volatile_doctest program~volatile_doctest~201->interface~bstr program~volatile_doctest~49 volatile_doctest program~volatile_doctest~49->interface~bstr program~volatile_doctest~62 volatile_doctest program~volatile_doctest~62->interface~bstr program~volatile_doctest~84 volatile_doctest program~volatile_doctest~84->interface~bstr

Source Code

   elemental function bstr_R8P(n) result(bstr)
   !< Convert real to string of bits.
   !<
   !< @note It is assumed that R8P is represented by means of 64 bits, but this is not ensured in all architectures.
   !<
   !<```fortran
   !< use penf
   !< print "(A)", bstr(n=1._R8P)
   !<```
   !=> 0000000000000000000000000000000000000000000000001111000000111111 <<<
   real(R8P), intent(in) :: n         !< Real to be converted.
   character(64)         :: bstr      !< Returned bit-string containing input number.
   integer(I1P)          :: buffer(8) !< Transfer buffer.

   buffer = transfer(n, buffer)
   write(bstr, '(8B8.8)') buffer
   endfunction bstr_R8P