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.
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 Cexceptions 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:
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.