All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::FloatingExceptionOnNaN Class Reference

Alter floating-point exception flag. More...

#include <Utilities.h>

Public Member Functions

 FloatingExceptionOnNaN (bool enable=true)
 
 ~FloatingExceptionOnNaN ()
 

Protected Attributes

fexcept_t fBackup
 

Detailed Description

Alter floating-point exception flag.

Upon going out of scope, restores the previous setting

Definition at line 80 of file sbnana/sbnana/CAFAna/Core/Utilities.h.

Constructor & Destructor Documentation

ana::FloatingExceptionOnNaN::FloatingExceptionOnNaN ( bool  enable = true)

Definition at line 67 of file sbnana/sbnana/CAFAna/Core/Utilities.cxx.

68  {
69  // Don't want any pending FPEs to trigger when we flip exceptions
70  // on. Whoever had them off previously had a reason.
71  feclearexcept(FE_INVALID);
72 
73  fegetexceptflag(&fBackup, FE_INVALID);
74 
75 #ifndef DARWINBUILD
76  if(enable)
77  feenableexcept(FE_INVALID);
78  else
79  fedisableexcept(FE_INVALID);
80 #else
81  std::cerr << "WARNING: CAFAna/Core/Utilities.cxx built on OS X, no feenableexcept available" << std::endl;
82 #endif
83  }
BEGIN_PROLOG could also be cerr
ana::FloatingExceptionOnNaN::~FloatingExceptionOnNaN ( )

Definition at line 86 of file sbnana/sbnana/CAFAna/Core/Utilities.cxx.

87  {
88  fesetexceptflag(&fBackup, FE_INVALID);
89  }

Member Data Documentation

fexcept_t ana::FloatingExceptionOnNaN::fBackup
protected

Definition at line 86 of file sbnana/sbnana/CAFAna/Core/Utilities.h.


The documentation for this class was generated from the following files: