Years ago I wrote programs kinds95.f90 which does nothing beyond Fortran 95 except reading ‘INF’ as real if a compiler allows that, and kinds03.f90 in Fortran 2003 dialect. They print useful properties of all the real and integer kinds known to a compiler (huge,precision,tiny,radix and many more). They are publicly available in
https://homepages.ecs.vuw.ac.nz/~harper/kinds95.f90
and
https://homepages.ecs.vuw.ac.nz/~harper/kinds03.f90
I have recently updated them by testing whether exponent(inf)==huge(1)
, where inf
is either an IEEE value (kinds03.f90 only) or the result of reading ‘INF’ into a real variable (both programs), because that is a more severe test than just printing the value of inf
.
The programs compile, run and print correct results with gfortran, ifx and ifort in a Linux system. They compile, run and reveal problems with g95 and AMD flang. Lfortran 0.41.0 can’t compile them. I don’t know what happens in non-Linux systems or other compilers.