VTK/Examples/Cxx/SimpleOperations/FloatingPointExceptions

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Revision as of 17:12, 23 March 2010 by Francoisbertel (talk | contribs)
Jump to navigationJump to search

RandomNumbers.cxx

#include <vtkFloatingPointExceptions.h>

int main(int argc, char *argv[])
{
  vtkFloatingPointExceptions::Enable(); // disabled 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 EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
PROJECT(FloatingPointExceptions)

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

ADD_EXECUTABLE(FloatingPointExceptions FloatingPointExceptions.cxx)
TARGET_LINK_LIBRARIES(FloatingPointExceptions vtkCommon)