Date: 2013-07-02T14:39:23+00:00

Actual source code: ex3.c
petsc-3.4.2 2013-07-02

      2: static char help[] = "Tests catching of floating point exceptions.\n\n";

      4: #include <petscsys.h>

      8: int CreateError(PetscReal x)
      9: {

     13:   x    = 1.0/x;
     14:   PetscPrintf(PETSC_COMM_SELF,"x = %G\n",x);
     15:   return(0);
     16: }

     20: int main(int argc,char **argv)
     21: {
     23:   PetscInitialize(&argc,&argv,(char*)0,help);
     24:   PetscPrintf(PETSC_COMM_SELF,"This is a contrived example to test floating pointing\n");
     25:   PetscPrintf(PETSC_COMM_SELF,"It is not a true error.\n");
     26:   PetscPrintf(PETSC_COMM_SELF,"Run with -fp_trap to catch the floating point error\n");
     27:   CreateError(0.0);
     28:   return 0;
     29: }