pkgsrc/math/algae/patches/patch-aa
jtb 0010661e2c Initial import of algae.
Algae is an interpreted language for numerical analysis.  Algae
borrows ideas from languages like MATLAB, APL, and C, but it was
developed in response to a need for a free, efficient, and versatile
high-level language with large problem capability.
2002-05-04 01:10:02 +00:00

45 lines
912 B
Text

$NetBSD: patch-aa,v 1.1.1.1 2002/05/04 01:10:03 jtb Exp $
--- /dev/null Tue Jan 2 02:09:36 2001
+++ fpe/netbsd1.5.c
@@ -0,0 +1,40 @@
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <ieeefp.h>
+#include <setjmp.h>
+#include <signal.h>
+
+#if !SKIP_LOCAL_INCLUDES
+#include "exception.h"
+#include "message.h"
+#endif
+
+static void
+catch_sigfpe (int sig, int code, struct sigcontext *scp)
+{
+ fail ("Floating point exception.");
+ raise_exception ();
+}
+
+void
+enable_fpe_traps ()
+{
+ struct sigaction act;
+
+ act.sa_handler = (void (*)(int)) catch_sigfpe;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+
+ if (sigaction (SIGFPE, &act, NULL))
+ wipeout ("Bad sigaction call.");
+
+ sigaddset (&act.sa_mask, SIGFPE);
+ sigprocmask (SIG_UNBLOCK, &act.sa_mask, NULL);
+
+ fpsetmask (FP_X_INV | FP_X_DZ | FP_X_OFL);
+}