Compute the number of bits of a real variable.
use penf
print FI1P, bit_size(1._R8P)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8P), | intent(in) | :: | i |
Real variable whose number of bits must be computed. |
Number of bits of r.
elemental function bit_size_R8P(i) result(bits) !< Compute the number of bits of a real variable. !< !<```fortran !< use penf !< print FI1P, bit_size(1._R8P) !<``` !=> 64 <<< real(R8P), intent(in) :: i !< Real variable whose number of bits must be computed. integer(I1P) :: bits !< Number of bits of r. integer(I1P) :: mold(1) !< "Molding" dummy variable for bits counting. bits = size(transfer(i, mold), dim=1, kind=I1P) * 8_I1P endfunction bit_size_R8P