Queries or changes the mode of the user process to allow floating-point exceptions to generate traps.
Standard C Library (libc.a)
#include <fptrap.h> int fp_trap(flag) int flag;
The fp_trap subroutine queries and changes the mode of the user process to allow or disallow floating-point exception trapping. Floating-point traps can only be generated when a process is executing in a traps-enabled mode.
The default state is to execute in pipelined mode and not to generate floating-point traps.
Note: The fp_trap routines only change the execution state of the process. To generate floating-point traps, you must also enable traps. Use the fp_enable and fp_enable_all subroutines to enable traps.
Before calling the fp_trap(FP_TRAP_SYNC) routine, previous floating-point operations can set to True certain exception bits in the Floating-Point Status and Control register (FPSCR). Enabling these exceptions and calling the fp_trap(FP_TRAP_SYNC) routine does not cause an immediate trap to occur. That is, the operation of these traps is edge-sensitive, not level-sensitive.
The fp_trap subroutine does not clear the exception history. You can query this history by using any of the following subroutines:
|flag|| Specifies a query of or change in the mode of the user process:
If called with the FP_TRAP_OFF, FP_TRAP_IMP, FP_TRAP_IMP_REC, or FP_TRAP_SYNC flag, the fp_trap subroutine returns a value indicating which flag was in the previous mode of the process if the hardware supports the requested mode. If the hardware does not support the requested mode, the fp_trap subroutine returns FP_TRAP_UNIMPL.
If called with the FP_TRAP_QUERY flag, the fp_trap subroutine returns a value indicating the current mode of the process, either the FP_TRAP_OFF, FP_TRAP_IMP, FP_TRAP_IMP_REC, or FP_TRAP_SYNC flag.
If called with FP_TRAP_FASTMODE, the fp_trap subroutine sets the fastest mode available and returns the mode selected.
If the fp_trap subroutine is called with an invalid parameter, the subroutine returns FP_TRAP_ERROR.
If the requested mode is not supported on the hardware platform, the subroutine returns FP_TRAP_UNIMPL.