Skip to content

PENFPortability Environment for Fortran Poor People

A KISS library for portable, parametrized numerical types in modern Fortran (2003+)

Quick start ​

fortran
use penf
call penf_init

real(R8P)    :: x = -1.0_R8P
integer(I4P) :: n = 42_I4P

print FR8P, x !  -0.100000000000000E+001
print FI4P, n !          42

Real kinds ​

ParameterPrecisionRangeSize
R16P33 digits[10−4931, 10+4931−1]128 bit
R8P15 digits[10−307, 10+307−1]64 bit
R4P6 digits[10−37, 10+37−1]32 bit

Integer kinds ​

ParameterRangeSize
I8P[−263, +263−1]64 bit
I4P[−231, +231−1]32 bit
I2P[−215, +215−1]16 bit
I1P[−27, +27−1]8 bit

Format Strings ​

Each kind has a matching format string for print / write statements:

KindFormat stringExample output
R16PFR16P = '(E45.36E4)'-0.100000000000000000000000000000000000E+0001
R8PFR8P = '(E25.17E3)'-0.10000000000000000E+001
R4PFR4P = '(E16.9E2)'-0.100000000E+01
I8PFI8P = '(I20)' -1
I4PFI4P = '(I11)' -1
I2PFI2P = '(I6)' -1
I1PFI1P = '(I4)' -1

Authors ​

Contributions are welcome — see the Contributing page.

Copyrights ​

PENF is distributed under a multi-licensing system:

Anyone interested in using, developing, or contributing to PENF is welcome — pick the license that best fits your needs.