summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-11-01 00:50:45 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-11-01 00:50:45 +0000
commit2f77cf16c302743a4d584c022c8f750bf7aa9542 (patch)
tree00792b96877b0268c1517d2173d6cba05d930e47 /regress/lib
parent082b2bbe4b986ddddbd2e0a3eedcec855fb27271 (diff)
some floor() test
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libm/Makefile4
-rw-r--r--regress/lib/libm/floor/Makefile7
-rw-r--r--regress/lib/libm/floor/floor.c39
3 files changed, 48 insertions, 2 deletions
diff --git a/regress/lib/libm/Makefile b/regress/lib/libm/Makefile
index 0f6a15d65ec..dbe415ba541 100644
--- a/regress/lib/libm/Makefile
+++ b/regress/lib/libm/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.3 2003/02/12 07:08:44 mickey Exp $
+# $OpenBSD: Makefile,v 1.4 2003/11/01 00:50:44 mickey Exp $
-SUBDIR+= rint toint trivial1
+SUBDIR+= rint floor toint trivial1
install:
diff --git a/regress/lib/libm/floor/Makefile b/regress/lib/libm/floor/Makefile
new file mode 100644
index 00000000000..37340dcae5a
--- /dev/null
+++ b/regress/lib/libm/floor/Makefile
@@ -0,0 +1,7 @@
+# $OpenBSD: Makefile,v 1.1 2003/11/01 00:50:44 mickey Exp $
+
+PROG=floor
+LDADD=-lm
+DPADD=${LIBM}
+
+.include <bsd.regress.mk>
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);
+}