summaryrefslogtreecommitdiff
path: root/regress/lib/libm/floor/floor.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/lib/libm/floor/floor.c')
-rw-r--r--regress/lib/libm/floor/floor.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/regress/lib/libm/floor/floor.c b/regress/lib/libm/floor/floor.c
new file mode 100644
index 00000000000..239683f2890
--- /dev/null
+++ b/regress/lib/libm/floor/floor.c
@@ -0,0 +1,39 @@
+/* $OpenBSD: floor.c,v 1.1 2003/11/01 00:50:44 mickey Exp $ */
+
+/* Written by Michael Shalayeff, 2003, Public domain. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <unistd.h>
+#include <math.h>
+
+static void
+sigfpe(int sig, siginfo_t *si, void *v)
+{
+ char buf[132];
+
+ if (si) {
+ snprintf(buf, sizeof(buf), "sigfpe: addr=%p, code=%d\n",
+ si->si_addr, si->si_code);
+ write(1, buf, strlen(buf));
+ }
+ _exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_sigaction = sigfpe;
+ sa.sa_flags = SA_SIGINFO;
+ sigaction(SIGFPE, &sa, NULL);
+
+ if (floor(4294967295.7) != 4294967295.)
+ exit(1);
+
+ exit(0);
+}