Skip to main content
`Ctrl`+`K`

# PetscFPTrapPush

push a floating point trapping mode, restored using `PetscFPTrapPop()`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscFPTrapPush(PetscFPTrap trap)

Not Collective

## Input Parameter

- trap - `PETSC_FP_TRAP_ON` or `PETSC_FP_TRAP_OFF` or any of the values passable to `PetscSetFPTrap()`

## Notes

This only changes the trapping if the new mode is different than the current mode.

This routine is called to turn off trapping for certain LAPACK routines that assume that dividing by zero is acceptable. In particular the routine ieeeck().

Most systems by default have all trapping turned off, but certain Fortran compilers have link flags that turn on trapping before the program begins.

           gfortran -ffpe-trap=invalid,zero,overflow,underflow,denormal
           ifort -fpe0

## See Also

`PetscFPTrapPop()`, `PetscSetFPTrap()`, `PetscDetermineInitialFPTrap()`

## Level

advanced

## Location

src/sys/error/fp.c

## Examples

src/ksp/ksp/tutorials/ex59.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages