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: #undef __FUNCT__
9: int CreateError(PetscReal x)
10: {
13: x = 1.0/x;
14: PetscPrintf(PETSC_COMM_SELF,"x = %gn",x);
15: return(0);
16: }
18: #undef __FUNCT__
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 pointingn");
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 errorn");
27: CreateError(0.0);
28: return 0;
29: }
30: