Five intrinsic modules are provided by the implementation: one we
have seen iso_fortran_env
.
Three are related to IEEE arithmetic: ieee_arithmetic
, ieee_exceptions
and ieee_features
.
The last is iso_c_binding
which concerns C/Fortran interoperability.
A use statement may include, optionally, an intrinsic
or non_intrinsic
attribute, e.g.,
use, intrinsic :: iso_fortran_env
This true intrinsic iso_fortran_env
will then be used in preferrence to
any other module with the same name.
Likewise a non-intrinsic module can be used:
use, non_intrinsic :: iso_fortran_env
This would generate an error were a user-provided iso_fortran_env
be
unavailable to the compiler.
Best practice is always to use an only
clase with intrinsic modules,
which enumerates the names required in the current scope. This is a
general rule which limits "namespace pollution".
This module provides a number of symbolic constants and functions to provide information about the local Fortran implementation.
These include:
error_unit
,input_unit
andoutput_unit
: the unit numbers associated with standard error, standard input, and standard output.iostat_end
andiostat_eor
: error codes for end-fo-file and end-of-record.character_storage_size
,file_storage_size
, andnumeric_storage_size
related to i/o
F2008 included king type parameters for frequently used intrinsic data types:
int8
,int16
,int32
,int64
: integer kind type parameter for intrinsic integers (in bits);real32
,real64
,real128
: integer kind type parameters for intrinsic real data types.
Lists of the kind types available for each intrinsic data type are also
available: integer_kinds
, logical_kinds
, real_kinds
, character_kinds
.
Information on the compiler and the options at compile time can be accessed
via the functions: compiler_version()
and compiler_options()
. Both
return a string fixed at compile time.
E.g.,
character (len = *), parameter :: compiler = compiler_version()
An example program is provided which prints out the values of the various
symbols available from iso_fortran_env
.
$ ftn print_iso_fortran_env.f90
To see the actual values in the kind arrays (integer_kinds
and so on)
some extra statements would be required.
Fortran provides support for programmers to inquire about support for various aspects of the IEEE standard for floating point arithmetic. This information is separated into three modules.
ieee_exceptions
provides handling for IEEE exception types enumerated by the values:ieee_overflow
,ieee_divide_by_zero
,ieee_invalid
,ieee_underflow
andieee_inexact
.ieee_arithmetic
contains functionality for identifying different classes of floating point values (e.g.,ieee_negative_inf
), rounding modes, and so on. Theieee_arithmetic
module includeieee_exceptions
.ieee_features
does not provide names a such by may affect compilation if present. E.g., ifis present, then the program unit must provide support for subnormal floating point numbers (aka denormalised numbers, with a leading zero in the mantissa).use, intrinsic :: ieee_features, only : ieee_subnormal
A full description of the IEEE features will not be attempted here.