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