petsc-3.7.1 2016-05-15
Report Typos and Errors

# PetscSetFPTrap

Enables traps/exceptions on common floating point errors. This option may not work on certain machines.

### Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscSetFPTrap(PetscFPTrap flag)

Not Collective Many br

### Input Parameters

flag -PETSC_FP_TRAP_ON, PETSC_FP_TRAP_OFF. Many br

### Options Database Keys

-fp_trap -Activates floating point trapping Many br

Many br

### Description

On systems that support it, this routine causes floating point Many broverflow, divide-by-zero, and invalid-operand (e.g., a NaN) to Many brcause a message to be printed and the program to exit. Many br

### Note

On many common systems including x86 and x86-64 Linux, the floating Many brpoint exception state is not preserved from the location where the trap Many broccurred through to the signal handler. In this case, the signal handler Many brwill just say that an unknown floating point exception occurred and which Many brfunction it occurred in. If you run with -fp_trap in a debugger, it will Many brbreak on the line where the error occurred. You can check which Many brexception occurred using fetestexcept(FE_ALL_EXCEPT). See fenv.h Many br(usually at /usr/include/bits/fenv.h) for the enum values on your system. Many br

### Caution

On certain machines, in particular the IBM rs6000, floating point Many brtrapping is VERY slow! Many br

### See Also

PetscFPTrapPush(), PetscFPTrapPop()

Level:advanced
Location:src/sys/error/fp.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages