# PetscSetFPTrap

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

### Synopsis

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

Not Collective

### Input Parameters

flag -PETSC_FP_TRAP_ON, PETSC_FP_TRAP_OFF.

### Options Database Keys

-fp_trap -Activates floating point trapping

### Description

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

### Caution

On certain machines, in particular the IBM rs6000, floating point trapping is VERY slow!

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