Skip to content

penf_stringify

PENF string-to-number (and viceversa) facility.

Source: src/lib/penf_stringify.F90

Dependencies

Contents

Interfaces

str_ascii

Convert string of any kind to ASCII string.

Module procedures: str_ascii_default

str_ucs4

Convert string of any kind to UCS4 string.

Module procedures: str_ucs4_default

str

Convert number (real and integer) to string (number to string type casting).

Module procedures: strf_R8P, str_R8P, strf_R4P, str_R4P, strf_I8P, str_I8P, strf_I4P, str_I4P, strf_I2P, str_I2P, strf_I1P, str_I1P, str_bol, str_a_R8P, str_a_R4P, str_a_I8P, str_a_I4P, str_a_I2P, str_a_I1P

strz

Convert integer, to string, prefixing with the right number of zeros (integer to string type casting with zero padding).

Module procedures: strz_I8P, strz_I4P, strz_I2P, strz_I1P

cton

Convert string to number (real and integer, string to number type casting).

Module procedures: ctor_R8P, ctor_R4P, ctoi_I8P, ctoi_I4P, ctoi_I2P, ctoi_I1P

bstr

Convert number (real and integer) to bit-string (number to bit-string type casting).

Module procedures: bstr_R8P, bstr_R4P, bstr_I8P, bstr_I4P, bstr_I2P, bstr_I1P

bcton

Convert bit-string to number (real and integer, bit-string to number type casting).

Module procedures: bctor_R8P, bctor_R4P, bctoi_I8P, bctoi_I4P, bctoi_I2P, bctoi_I1P

Subroutines

compact_real_string

Compact a string representing a real number, so that the same value is displayed with fewer characters.

@note No need to add doctest: this is tested by a lot of doctests of other TBPs.

Attributes: pure

fortran
subroutine compact_real_string(string)

Arguments

NameTypeIntentAttributesDescription
stringcharacter(len=*)inoutstring representation of a real number.

Call graph

Functions

str_ascii_default

Convert string of default kind to ASCII string.

fortran
 use penf
 character(len=:, kind=ASCII), allocatable :: string
 string = str_ascii('I was DEFAULT kind, but now I am ASCII')
 print "(A)", string

Attributes: pure

Returns: character(kind=ASCII, len=:)

fortran
function str_ascii_default(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(len=*)inInput string of default kind.

str_ascii_ascii

Convert string of ASCII kind to ASCII string, just for convenience in sanitize strings.

fortran
 use penf
 character(len=:, kind=ASCII), allocatable :: string
 string = str_ascii('I was ASCII kind and I am still ASCII')
 print "(A)", string

Attributes: pure

Returns: character(kind=ASCII, len=:)

fortran
function str_ascii_ascii(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(kind=ASCII, len=*)inInput string of ASCII kind.

str_ascii_ucs4

Convert string of UCS4 kind to ASCII string.

fortran
 use penf
 character(len=:, kind=ASCII), allocatable :: string
 string = str_ascii(UCS4_'I was UCS4 kind, but now I am ASCII')
 print "(A)", string

Attributes: pure

Returns: character(kind=ASCII, len=:)

fortran
function str_ascii_ucs4(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(kind=UCS4, len=*)inInput string of UCS4 kind.

str_ucs4_default

Convert string of default kind to UCS4 string.

fortran
 use penf
 character(len=:, kind=UCS4), allocatable :: string
 string = str_ascii('I was DEFAULT kind, but now I am UCS4')
 print "(A)", string

Attributes: pure

Returns: character(kind=UCS4, len=:)

fortran
function str_ucs4_default(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(len=*)inInput string of default kind.

str_ucs4_ascii

Convert string of ASCII kind to UCS4 string.

fortran
 use penf
 character(len=:, kind=UCS4), allocatable :: string
 string = str_ascii(ASCII_'I was ASCII kind, but now I am UCS4')
 print "(A)", string

Attributes: pure

Returns: character(kind=UCS4, len=:)

fortran
function str_ucs4_ascii(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(kind=ASCII, len=*)inInput string of ASCII kind.

str_ucs4_ucs4

Convert string of UCS4 kind to UCS4 string, just for convenience in sanitize strings.

fortran
 use penf
 character(len=:, kind=UCS4), allocatable :: string
 string = str_ascii(UCS4_'I was UCS4 kind and I am still UCS4')
 print "(A)", string

Attributes: pure

Returns: character(kind=UCS4, len=:)

fortran
function str_ucs4_ucs4(input) result(output)

Arguments

NameTypeIntentAttributesDescription
inputcharacter(kind=UCS4, len=*)inInput string of UCS4 kind.

strf_R16P

Convert real to string.

fortran
 use penf
 print "(A)", str(fm=FR16P, n=1._R16P)

Attributes: elemental

Returns: character(len=DR16P)

fortran
function strf_R16P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
nreal(kind=R16P)inReal to be converted.

strf_R8P

Convert real to string.

fortran
 use penf
 print "(A)", str(fm=FR8P, n=1._R8P)

Attributes: elemental

Returns: character(len=DR8P)

fortran
function strf_R8P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
nreal(kind=R8P)inReal to be converted.

strf_R4P

Convert real to string.

fortran
 use penf
 print "(A)", str(fm=FR4P, n=1._R4P)

Attributes: elemental

Returns: character(len=DR4P)

fortran
function strf_R4P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
nreal(kind=R4P)inReal to be converted.

strf_I8P

Convert integer to string.

fortran
 use penf
 print "(A)", str(fm=FI8P, n=1_I8P)

Attributes: elemental

Returns: character(len=DI8P)

fortran
function strf_I8P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
ninteger(kind=I8P)inInteger to be converted.

strf_I4P

Convert integer to string.

fortran
 use penf
 print "(A)", str(fm=FI4P, n=1_I4P)

Attributes: elemental

Returns: character(len=DI4P)

fortran
function strf_I4P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
ninteger(kind=I4P)inInteger to be converted.

strf_I2P

Convert integer to string.

fortran
 use penf
 print "(A)", str(fm=FI2P, n=1_I2P)

Attributes: elemental

Returns: character(len=DI2P)

fortran
function strf_I2P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
ninteger(kind=I2P)inInteger to be converted.

strf_I1P

Convert integer to string.

fortran
 use penf
 print "(A)", str(fm=FI1P, n=1_I1P)

Attributes: elemental

Returns: character(len=DI1P)

fortran
function strf_I1P(fm, n) result(str)

Arguments

NameTypeIntentAttributesDescription
fmcharacter(len=*)inFormat different from the standard for the kind.
ninteger(kind=I1P)inInteger to be converted.

str_R16P

Convert real to string.

fortran
 use penf
 print "(A)", str(n=-1._R16P)
fortran
 use penf
 print "(A)", str(n=-1._R16P, no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=-1._R16P, compact=.true.)

Attributes: elemental

Returns: character(len=DR16P)

fortran
function str_R16P(n, no_sign, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R16P)inReal to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_R8P

Convert real to string.

fortran
 use penf
 print "(A)", str(n=-1._R8P)
fortran
 use penf
 print "(A)", str(n=-1._R8P, no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=-1._R8P, compact=.true.)

Attributes: elemental

Returns: character(len=DR8P)

fortran
function str_R8P(n, no_sign, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R8P)inReal to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_R4P

Convert real to string.

fortran
 use penf
 print "(A)", str(n=-1._R4P)
fortran
 use penf
 print "(A)", str(n=-1._R4P, no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=-1._R4P, compact=.true.)

Attributes: elemental

Returns: character(len=DR4P)

fortran
function str_R4P(n, no_sign, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R4P)inReal to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_I8P

Convert integer to string.

fortran
 use penf
 print "(A)", str(n=-1_I8P)
fortran
 use penf
 print "(A)", str(n=-1_I8P, no_sign=.true.)

Attributes: elemental

Returns: character(len=DI8P)

fortran
function str_I8P(n, no_sign) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I8P)inInteger to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.

Call graph

str_I4P

Converting integer to string.

fortran
 use penf
 print "(A)", str(n=-1_I4P)
fortran
 use penf
 print "(A)", str(n=-1_I4P, no_sign=.true.)

Attributes: elemental

Returns: character(len=DI4P)

fortran
function str_I4P(n, no_sign) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inInteger to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.

Call graph

str_I2P

Convert integer to string.

fortran
 use penf
 print "(A)", str(n=-1_I2P)
fortran
 use penf
 print "(A)", str(n=-1_I2P, no_sign=.true.)

Attributes: elemental

Returns: character(len=DI2P)

fortran
function str_I2P(n, no_sign) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I2P)inInteger to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.

Call graph

str_I1P

Convert integer to string.

fortran
 use penf
 print "(A)", str(n=-1_I1P)
fortran
 use penf
 print "(A)", str(n=-1_I1P, no_sign=.true.)

Attributes: elemental

Returns: character(len=DI1P)

fortran
function str_I1P(n, no_sign) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I1P)inInteger to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.

Call graph

str_bol

Convert logical to string.

fortran
 use penf
 print "(A)", str(n=.true.)

Attributes: elemental

Returns: character(len=1)

fortran
function str_bol(n) result(str)

Arguments

NameTypeIntentAttributesDescription
nlogicalinLogical to be converted.

str_a_R16P

Converting real array to string.

fortran
 use penf
 print "(A)", str(n=[1._R16P, -2._R16P])
fortran
 use penf
 print "(A)", str(n=[1._R16P, 2._R16P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1._R16P, -2._R16P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1._R16P, -3._R16P], delimiters=['(', ')'])
fortran
 use penf
 print "(A)", str(n=[1._R16P, -2._R16P], compact=.true.)

Attributes: pure

Returns: character(len=:)

fortran
function str_a_R16P(n, no_sign, separator, delimiters, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R16P)inReal array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_a_R8P

Convert real array to string.

fortran
 use penf
 print "(A)", str(n=[1._R8P, -2._R8P])
fortran
 use penf
 print "(A)", str(n=[1._R8P, 2._R8P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1._R8P, -2._R8P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1._R8P, -2._R8P], delimiters=['(', ')'])
fortran
 use penf
 print "(A)", str(n=[1._R8P, -2._R8P], compact=.true.)

Attributes: pure

Returns: character(len=:)

fortran
function str_a_R8P(n, no_sign, separator, delimiters, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R8P)inReal array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_a_R4P

Convert real array to string.

fortran
 use penf
 print "(A)", str(n=[1._R4P, -2._R4P])
fortran
 use penf
 print "(A)", str(n=[1._R4P, 2._R4P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1._R4P, -2._R4P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1._R4P, -2._R4P], delimiters=['(', ')'])
fortran
 use penf
 print "(A)", str(n=[1._R4P, -2._R4P], compact=.true.)

Attributes: pure

Returns: character(len=:)

fortran
function str_a_R4P(n, no_sign, separator, delimiters, compact) result(str)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R4P)inReal array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.
compactlogicalinoptionalFlag for compacting string encoding.

Call graph

str_a_I8P

Convert integer array to string.

fortran
 use penf
 print "(A)", str(n=[1_I8P, -2_I8P])
fortran
 use penf
 print "(A)", str(n=[1_I8P, 2_I8P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1_I8P, -2_I8P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1_I8P, -2_I8P], delimiters=['(', ')'])

Attributes: pure

Returns: character(len=:)

fortran
function str_a_I8P(n, no_sign, separator, delimiters) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I8P)inInteger array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.

Call graph

str_a_I4P

Convert integer array to string.

fortran
 use penf
 print "(A)", str(n=[1_I4P, -2_I4P])
fortran
 use penf
 print "(A)", str(n=[1_I4P, 2_I4P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1_I4P, -2_I4P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1_I4P, -2_I4P], delimiters=['(', ')'])

Attributes: pure

Returns: character(len=:)

fortran
function str_a_I4P(n, no_sign, separator, delimiters) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inInteger array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.

Call graph

str_a_I2P

Convert integer array to string.

fortran
 use penf
 print "(A)", str(n=[1_I2P, -2_I2P])
fortran
 use penf
 print "(A)", str(n=[1_I2P, 2_I2P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1_I2P, -2_I2P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1_I2P, -2_I2P], delimiters=['(', ')'])

Attributes: pure

Returns: character(len=:)

fortran
function str_a_I2P(n, no_sign, separator, delimiters) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I2P)inInteger array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.

Call graph

str_a_I1P

Convert integer array to string.

fortran
 use penf
 print "(A)", str(n=[1_I1P, -2_I1P])
fortran
 use penf
 print "(A)", str(n=[1_I1P, 2_I1P], no_sign=.true.)
fortran
 use penf
 print "(A)", str(n=[1_I1P, -2_I1P], separator='|')
fortran
 use penf
 print "(A)", str(n=[1_I1P, -2_I1P], delimiters=['(', ')'])

Attributes: pure

Returns: character(len=:)

fortran
function str_a_I1P(n, no_sign, separator, delimiters) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I1P)inInteger array to be converted.
no_signlogicalinoptionalFlag for leaving out the sign.
separatorcharacter(len=1)inoptionalEventual separator of array values.
delimiterscharacter(len=*)inoptionalEventual delimiters of array values.

Call graph

strz_I8P

Converting integer to string, prefixing with the right number of zeros.

fortran
 use penf
 print "(A)", strz(n=1_I8P)
fortran
 use penf
 print "(A)", strz(n=1_I8P, nz_pad=5)

Attributes: elemental

Returns: character(len=DI8P)

fortran
function strz_I8P(n, nz_pad) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I8P)inInteger to be converted.
nz_padinteger(kind=I4P)inoptionalNumber of zeros padding.

strz_I4P

Convert integer to string, prefixing with the right number of zeros.

fortran
 use penf
 print "(A)", strz(n=1_I4P)
fortran
 use penf
 print "(A)", strz(n=1_I4P, nz_pad=5)

Attributes: elemental

Returns: character(len=DI4P)

fortran
function strz_I4P(n, nz_pad) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inInteger to be converted.
nz_padinteger(kind=I4P)inoptionalNumber of zeros padding.

strz_I2P

Convert integer to string, prefixing with the right number of zeros.

fortran
 use penf
 print "(A)", strz(n=1_I2P)
fortran
 use penf
 print "(A)", strz(n=1_I2P, nz_pad=3)

Attributes: elemental

Returns: character(len=DI2P)

fortran
function strz_I2P(n, nz_pad) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I2P)inInteger to be converted.
nz_padinteger(kind=I4P)inoptionalNumber of zeros padding.

strz_I1P

Convert integer to string, prefixing with the right number of zeros.

fortran
 use penf
 print "(A)", strz(n=1_I1P)
fortran
 use penf
 print "(A)", strz(n=1_I1P, nz_pad=3)

Attributes: elemental

Returns: character(len=DI1P)

fortran
function strz_I1P(n, nz_pad) result(str)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I1P)inInteger to be converted.
nz_padinteger(kind=I4P)inoptionalNumber of zeros padding.

ctor_R16P

Convert string to real.

fortran
 use penf
 print FR16P, cton(str='-1.0', knd=1._R16P)

Returns: real(kind=R16P)

fortran
function ctor_R16P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndreal(kind=R16P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctor_R8P

Convert string to real.

fortran
 use penf
 print FR8P, cton(str='-1.0', knd=1._R8P)

Returns: real(kind=R8P)

fortran
function ctor_R8P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndreal(kind=R8P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctor_R4P

Convert string to real.

fortran
 use penf
 print FR4P, cton(str='-1.0', knd=1._R4P)

Returns: real(kind=R4P)

fortran
function ctor_R4P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndreal(kind=R4P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctoi_I8P

Convert string to integer.

fortran
 use penf
 print FI8P, cton(str='-1', knd=1_I8P)

Returns: integer(kind=I8P)

fortran
function ctoi_I8P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndinteger(kind=I8P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctoi_I4P

Convert string to integer.

fortran
 use penf
 print FI4P, cton(str='-1', knd=1_I4P)

Returns: integer(kind=I4P)

fortran
function ctoi_I4P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndinteger(kind=I4P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctoi_I2P

Convert string to integer.

fortran
 use penf
 print FI2P, cton(str='-1', knd=1_I2P)

Returns: integer(kind=I2P)

fortran
function ctoi_I2P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndinteger(kind=I2P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

ctoi_I1P

Convert string to integer.

fortran
 use penf
 print FI1P, cton(str='-1', knd=1_I1P)

Returns: integer(kind=I1P)

fortran
function ctoi_I1P(str, knd, pref, error) result(n)

Arguments

NameTypeIntentAttributesDescription
strcharacter(len=*)inString containing input number.
kndinteger(kind=I1P)inNumber kind.
prefcharacter(len=*)inoptionalPrefixing string.
errorinteger(kind=I4P)outoptionalError trapping flag: 0 no errors, >0 error occurs.

bstr_R16P

Convert real to string of bits.

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

fortran
 use penf
 character(128) :: b
 b = bstr(n=1._R16P)
 print "(A)", b(17:)

Attributes: elemental

Returns: character(len=128)

fortran
function bstr_R16P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R16P)inReal to be converted.

bstr_R8P

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)

Attributes: elemental

Returns: character(len=64)

fortran
function bstr_R8P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R8P)inReal to be converted.

bstr_R4P

Convert real to string of bits.

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

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

Attributes: elemental

Returns: character(len=32)

fortran
function bstr_R4P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
nreal(kind=R4P)inReal to be converted.

bstr_I8P

Convert integer to string of bits.

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

fortran
 use penf
 print "(A)", bstr(n=1_I8P)

Attributes: elemental

Returns: character(len=64)

fortran
function bstr_I8P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I8P)inReal to be converted.

bstr_I4P

Convert integer to string of bits.

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

fortran
 use penf
 print "(A)", bstr(n=1_I4P)

Attributes: elemental

Returns: character(len=32)

fortran
function bstr_I4P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inReal to be converted.

bstr_I2P

Convert integer to string of bits.

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

fortran
 use penf
 print "(A)", bstr(n=1_I2P)

Attributes: elemental

Returns: character(len=16)

fortran
function bstr_I2P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I2P)inReal to be converted.

bstr_I1P

Convert integer to string of bits.

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

fortran
 use penf
 print "(A)", bstr(n=1_I1P)

Attributes: elemental

Returns: character(len=8)

fortran
function bstr_I1P(n) result(bstr)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I1P)inReal to be converted.

bctor_R16P

Convert bit-string to real.

fortran
 use penf
 print FR16P, bcton('00000000000000000000000000000000000000000000000000000000000000000000000000000'//&
                    '000000000000000000000000000000000001111111100111111', knd=1._R16P)

Attributes: elemental

Returns: real(kind=R16P)

fortran
function bctor_R16P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndreal(kind=R16P)inNumber kind.

bctor_R8P

Convert bit-string to real.

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

Attributes: elemental

Returns: real(kind=R8P)

fortran
function bctor_R8P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndreal(kind=R8P)inNumber kind.

bctor_R4P

Convert bit-string to real.

fortran
 use penf
 print FR4P, bcton('00000000000000001000000000111111', knd=1._R4P)

Attributes: elemental

Returns: real(kind=R4P)

fortran
function bctor_R4P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndreal(kind=R4P)inNumber kind.

bctoi_I8P

Convert bit-string to integer.

fortran
 use penf
 print FI8P, bcton('0000000000000000000000000000000000000000000000000000000000000001', knd=1_I8P)

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function bctoi_I8P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndinteger(kind=I8P)inNumber kind.

Call graph

bctoi_I4P

Convert bit-string to integer.

fortran
 use penf
 print FI4P, bcton('00000000000000000000000000000001', knd=1_I4P)

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function bctoi_I4P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndinteger(kind=I4P)inNumber kind.

Call graph

bctoi_I2P

Convert bit-string to integer.

fortran
 use penf
 print FI2P, bcton('0000000000000001', knd=1_I2P)

Attributes: elemental

Returns: integer(kind=I2P)

fortran
function bctoi_I2P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndinteger(kind=I2P)inNumber kind.

Call graph

bctoi_I1P

Convert bit-string to integer.

fortran
 use penf
 print FI1P, bcton('00000001', knd=1_I1P)

Attributes: elemental

Returns: integer(kind=I1P)

fortran
function bctoi_I1P(bstr, knd) result(n)

Arguments

NameTypeIntentAttributesDescription
bstrcharacter(len=*)inString containing input number.
kndinteger(kind=I1P)inNumber kind.

Call graph