]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated code to trap the floating point exception. Works on Linux with glibc 2.2...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Jan 2007 11:30:24 +0000 (11:30 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Jan 2007 11:30:24 +0000 (11:30 +0000)
ALIROOT/fpu.c

index 945fbdc2cb0e1989674b3140156099211d17badf..4fda4d6fec87b64b91a4819a2f3db1a08d356f8c 100644 (file)
@@ -1,14 +1,11 @@
 #ifdef __linux
-#if defined (__ia64) || defined (__x86_64)
-#else
-#include <fpu_control.h>
-void __attribute__ ((constructor))
-     trapfpe () {
-  fpu_control_t cw = _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM |
-                                     _FPU_MASK_OM);
-  _FPU_SETCW(cw);
+#define _GNU_SOURCE 1
+#include <fenv.h>
+static void __attribute__ ((constructor)) trapfpe(void)
+{
+  /* Enable some exceptions. At startup all exceptions are masked. */
+  feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);
 }
-#endif
 #else
 void trapfpe () {}
 #endif