VTK/Examples/Cxx/SimpleOperations/FloatingPointExceptions

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Revision as of 09:08, 23 March 2010 by Francoisbertel (talk | contribs) (Created page with ' ==RandomNumbers.cxx== <source lang="cpp"> #include <vtkFloatingPointExceptions.h> int main(int argc, char *argv[]) { vtkFloatingPointExceptions::Enable(); // disable by defau…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

RandomNumbers.cxx

#include <vtkFloatingPointExceptions.h>

int main(int argc, char *argv[])
{
  vtkFloatingPointExceptions::Enable(); // disable by default with gcc or visual studio, enabled by default by Borland CC.
  
  double x=0.0;
  double y=1.0/x; // floating-point exception
  
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
PROJECT(FloatinPointExceptions)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

ADD_EXECUTABLE(FloatinPointExceptions FloatinPointExceptions.cxx)
TARGET_LINK_LIBRARIES(FloatinPointExceptions vtkCommon)