Enables traps/exceptions on common floating point errors. This option may not work on certain systems.
PetscErrorCode PetscSetFPTrap(PetscFPTrap flag)
flag -PETSC_FP_TRAP_ON, PETSC_FP_TRAP_OFF.
Options Database Keys
-fp_trap -Activates floating point trapping
On systems that support it, when called with PETSC_FP_TRAP_ON this routine causes floating point
underflow, overflow, divide-by-zero, and invalid-operand (e.g., a NaN) to
cause a message to be printed and the program to exit.
On many common systems, the floating
point exception state is not preserved from the location where the trap
occurred through to the signal handler. In this case, the signal handler
will just say that an unknown floating point exception occurred and which
function it occurred in. If you run with -fp_trap in a debugger, it will
break on the line where the error occurred. On systems that support C99
floating point exception handling You can check which
exception occurred using fetestexcept(FE_ALL_EXCEPT). See fenv.h
(usually at /usr/include/bits/fenv.h) for the enum values on your system.
On certain machines, in particular the IBM PowerPC, floating point
trapping may be VERY slow!
PetscFPTrapPush(), PetscFPTrapPop(), PetscDetermineInitialFPTrap()
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages