Skip to content

Commit

Permalink
test code for Floating point arithmetic debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
copyme committed Oct 16, 2018
1 parent 04377a4 commit 716d6d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/DGtal/base/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
**/
namespace DGtal
{

#ifndef NDEBUG
#ifdef __GNUG__
void beforeMain (void) __attribute__((constructor));
void beforeMain (void)
{
feenableexcept ( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
}
#endif
#endif

TraceWriterTerm traceWriterTerm(std::cerr);
Trace trace(traceWriterTerm);
}
Expand Down
5 changes: 5 additions & 0 deletions src/DGtal/base/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
#include <boost/concept_archetype.hpp>
#include <boost/static_assert.hpp>

#ifndef NDEBUG
#include <fenv.h>
#endif


#ifdef _MSC_VER
#define NOMINMAX
#include <windows.h>
Expand Down

0 comments on commit 716d6d6

Please sign in to comment.