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.nn";
5: #include petsc.h
7: int CreateError(PetscReal x)
8: {
11: x = 1.0/x;
12: PetscPrintf(PETSC_COMM_SELF,"x = %gn",x);
13: return(0);
14: }
16: int main(int argc,char **argv)
17: {
19: PetscInitialize(&argc,&argv,(char *)0,help);
20: PetscPrintf(PETSC_COMM_SELF,"This is a contrived example to test floating pointingn");
21: PetscPrintf(PETSC_COMM_SELF,"It is not a true error.n");
22: PetscPrintf(PETSC_COMM_SELF,"Run with -fp_trap to catch the floating point errorn");
23: CreateError(0.0);
24: return 0;
25: }
26: