XL Fortran for AIX 8.1

Language Reference


Efficient Floating-point Control and Inquiry Procedures

XL Fortran provides several procedures that allow you to query and control the floating-point status and control register of the processor directly. These procedures are more efficient than the fpgets and fpsets subroutines because they are mapped into inlined machine instructions that manipulate the floating-point status and control register (fpscr) directly.

XL Fortran supplies the module xlf_fp_util, which contains the interfaces and data type definitions for these procedures and the definitions for the named constants that are needed by the procedures. This module enables type checking of these procedures at compile time rather than at link time. You can use the argument names listed in the examples as the names for keyword arguments when calling the procedure. The following files are supplied for the modules xlf_fp_util:

File names File type Locations
xlf_fp_util.mod module symbol file (32-bit)
  • /usr/lpp/xlf/include_32_d10
  • /usr/lpp/xlf/include_32_d7
Note:
The files in these directories are exact copies of one another.
module symbol file (64-bit) /usr/lpp/xlf/include_64

To use these procedures, you must add a USE XLF_FP_UTIL statement to your source file. For more information on USE, see USE.

If there are name conflicts (for example if the accessing subprogram has an entity with the same name as a module entity), use the ONLY clause or the renaming features of the USE statement. For example,

USE XLF_FP_UTIL, NULL1 => get_fpscr, NULL2 => set_fpscr

When compiling with the -U option, you must code the names of these procedures in all lowercase. We will show the names in lowercase here as a reminder.

The fpscr procedures are:

The following table lists the constants that are used with the fpscr procedures:

Family Constant Description
General
FPSCR_KIND The kind type parameter for a fpscr flags variable
FP_MODE_KIND The kind type parameter for fp_trap arguments and results
IEEE Rounding Modes
FP_RND_RN Round toward nearest (default)
FP_RND_RZ Round toward zero
FP_RND_RP Round toward plus infinity
FP_RND_RM Round toward minus infinity
FP_RND_MODE Used to obtain the rounding mode from a fpscr flags variable or value
IEEE Exception Enable Flags(1)
TRP_INEXACT Enable inexact trap
TRP_DIV_BY_ZERO Enable divide-by-zero trap
TRP_UNDERFLOW Enable underflow trap
TRP_OVERFLOW Enable overflow trap
TRP_INVALID Enable invalid trap
FP_ENBL_SUMM Trap enable summary or enable all
IEEE Exception Status Flags
FP_INVALID Invalid operation exception
FP_OVERFLOW Overflow exception
FP_UNDERFLOW Underflow exception
FP_DIV_BY_ZERO Divide-by-zero exception
FP_INEXACT Inexact exception
FP_ALL_IEEE_XCP All IEEE exceptions summary flags
FP_COMMON_IEEE_XCP All IEEE exceptions summary flags excluding the FP_INEXACT exception
Machine Specific Exception Details Flags
FP_INV_SNAN Signalling NaN
FP_INV_ISI Infinity - Infinity
FP_INV_IDI Infinity / Infinity
FP_INV_ZDZ 0 / 0
FP_INV_IMZ Infinity * 0
FP_INV_CMP Unordered compare
FP_INV_SQRT Square root of negative number
FP_INV_CVI Conversion to integer error
FP_INV_VXSOFT Software request
Machine Specific Exception Summary Flags
FP_ANY_XCP Any exception summary flag
FP_ALL_XCP All exceptions summary flags
FP_COMMON_XCP All exceptions summary flags excluding the FP_INEXACT exception
fp_trap constants(2)
FP_TRAP_SYNC Precise trapping on
FP_TRAP_OFF Trapping off
FP_TRAP_QUERY Query trapping mode
FP_TRAP_IMP Non-recoverable imprecise trapping on
FP_TRAP_IMP_REC Recoverable imprecise trapping on
FP_TRAP_FASTMODE Select fastest available mode
FP_TRAP_ERROR Error condition
FP_TRAP_UNIMPL Requested mode not available

Notes:

  1. In order to enable exception trapping, you must set the desired IEEE Exception Enable Flags and,

  2. For more information on fp_trap constants, see fp_trap in Technical Reference: Base Operating System and Extensions Volume 1.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]