capture floating point exception checking logic for future use
#include <string>
#include <vector>
+#ifdef FECHECKS
+#include <fenv.h>
+#endif
+
using std::string;
using std::vector;
using std::ostringstream;
@@ -219,6 +223,8 @@ avtFilter::UpdateProgress(int current, int total)
// Take memory measurements on BGQ so we can get an idea of how much
// memory is used/left.
//
+// Mark C. Miller, Thu Apr 27 18:08:19 PDT 2017
+// Capture floating point exception (FE) logic for future use.
// ****************************************************************************
bool
@@ -288,9 +294,28 @@ avtFilter::Update(avtContract_p contract)
DumpDataObject(GetInput(), "input");
numInExecute++;
+#ifdef FECHECKS
+ feclearexcept(FE_ALL_EXCEPT);
+#endif
+
PreExecute();
Execute();
PostExecute();
+
+#ifdef FECHECKS
+ int feerr = fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW);
+ if (feerr)
+ {
+ feclearexcept(FE_ALL_EXCEPT);
+ debug1 << "FPE(s) encountered in " << GetType() << " ";
+ if (feerr & FE_INVALID) debug1 << "FE_INVALID ";
+ if (feerr & FE_DIVBYZERO) debug1 << "FE_DIVBYZERO ";
+ if (feerr & FE_OVERFLOW) debug1 << "FE_OVERFLOW ";
+ if (feerr & FE_UNDERFLOW) debug1 << "FE_UNDERFLOW ";
+ debug1 << endl;
+ }
+#endif
+
if (debug_dump)
DumpDataObject(GetOutput(), "output");
UpdateProgress(1, 0);
