Intel® Fortran Compiler 17.0 Developer Guide and Reference
Intel® Fortran includes IEEE intrinsic modules that support IEEE arithmetic and exception handling. The modules contain derived data types that include named constants for controlling the level of support, and intrinsic module procedures.
To include an IEEE module in your program, specify the intrinsic module name in a USE statement; for example:
USE,INTRINSIC :: IEEE_ARITHMETIC
You must include the INTRINSIC attribute or the processor will look for a non-intrinsic module. Once you include a module, all related intrinsic procedures are defined.
The following three IEEE intrinsic modules are described in this section:
Before using a particular IEEE feature, you can determine whether your processor supports it by using the IEEE inquiry functions (listed in Table 1).
For example:
To determine whether IEEE arithmetic is available for a particular kind of real, use intrinsic module function IEEE_SUPPORT_DATATYPE.
To determine whether you can change a rounding mode, use intrinsic module function IEEE_SUPPORT_ROUNDING.
To determine whether a divide operation will be supported with the accuracy specified by the IEEE standard, use intrinsic module function IEEE_SUPPORT_DIVIDE.
To determine whether you can control halting after an exception has occurred, use intrinsic module function IEEE_SUPPORT_HALTING.
To determine which exceptions are supported in a scoping unit, use intrinsic module function IEEE_SUPPORT_FLAG.
To determine whether all IEEE features are supported, use intrinsic module function IEEE_SUPPORT_STANDARD.
The following intrinsic procedures can only be invoked if IEEE_SUPPORT_DATATYPE is true for their arguments:
IEEE_CLASS |
IEEE_SUPPORT_DENORMAL |
IEEE_COPY_SIGN |
IEEE_SUPPORT_DIVIDE |
IEEE_IS_FINITE |
IEEE_SUPPORT_INR |
IEEE_NEGATIVE |
IEEE_SUPPORT_IO |
IEEE_IS_NORMAL |
IEEE_SUPPORT_NAN |
IEEE_LOGB |
IEEE_SUPPORT_ROUNDING |
IEEE_NEXT_AFTER |
IEEE_SUPPORT_SQRT |
IEEE_REM |
IEEE_SUPPORT_UNORDERED |
IEEE_RINT |
IEEE_SUPPORT_VALUE |
IEEE_SCALB |
IEEE_VALUE |
IEEE_SET_ROUNDING_MODE1 |
IEEE_SUPPORT_ROUNDING |
1 IEEE_SUPPORT_ROUNDING(ROUND_VALUE, X) must also be true. |
For example, the IEEE_IS_NORMAL(X) function can only be invoked if IEEE_SUPPORT_DATATYPE(X) has the value true. Consider the following:
USE, INTRINSIC :: IEEE_ARITHMETIC
...
IF IEEE_SUPPORT_DATATYPE(X) THEN
IF IEEE_IS_NORMAL(X) THEN
PRINT *, ' X is a "normal" '
ELSE
PRINT *, ' X is not "normal" '
ENDIF
ELSE
PRINT *, ' X is not a supported IEEE type '
ENDIF
...
Certain other IEEE intrinsic module procedures have similar restrictions:
IEEE_IS_NAN(X) can only be invoked if IEEE_SUPPORT_NAN(X) has the value true.
IEEE_SET_HALTING_MODE(FLAG, HALTING) can only be invoked if IEEE_SUPPORT_HALTING(FLAG) has the value true.
IEEE_GET_UNDERFLOW_MODE(GRADUAL) can only be invoked if IEEE_SUPPORT_UNDERFLOW_CONTROL(X) is true for some X.
For intrinsic module function IEEE_CLASS(X), some of the possible return values also have restrictions. These restrictions are also true for argument CLASS in intrinsic module function IEEE_VALUE(X, CLASS):
IEEE_POSITIVE_INF and IEEE_NEGATIVE_INF can only be returned if IEEE_SUPPORT_INF(X) has the value true.
IEEE_POSITIVE_DENORMAL and IEEE_NEGATIVE_DENORMAL can only be returned if IEEE_SUPPORT_DENORMAL(X) has the value true.
IEEE_SIGNALING_NAN and IEEE_QUIET_NAN can only be returned if IEEE_SUPPORT_NAN(X) has the value true.