Actual source code: ex3.c
1: /*$Id: ex3.c,v 1.18 2001/08/07 21:29:12 bsmith Exp $*/
3: static char help[] = "Tests catching of floating point exceptions.\n\n";
5: #include petsc.h
9: int CreateError(PetscReal x)
10: {
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: }
30: