diff options
author | 2003-02-12 07:05:34 +0000 | |
---|---|---|
committer | 2003-02-12 07:05:34 +0000 | |
commit | d99f3947a0fe218cbd4ffbe3463519a143bbcabd (patch) | |
tree | 3c0dd686235bf3ed1865d5578cf5fb652c717822 | |
parent | simple alloca test. done twice per deraadt@ suggest (diff) | |
download | wireguard-openbsd-d99f3947a0fe218cbd4ffbe3463519a143bbcabd.tar.xz wireguard-openbsd-d99f3947a0fe218cbd4ffbe3463519a143bbcabd.zip |
a very simple rint() test. helped figure out fpu emulation probs on hppa
-rw-r--r-- | regress/lib/libm/Makefile | 4 | ||||
-rw-r--r-- | regress/lib/libm/rint/Makefile | 7 | ||||
-rw-r--r-- | regress/lib/libm/rint/rint.c | 37 |
3 files changed, 46 insertions, 2 deletions
diff --git a/regress/lib/libm/Makefile b/regress/lib/libm/Makefile index 8404e9159ef..b2364257ee2 100644 --- a/regress/lib/libm/Makefile +++ b/regress/lib/libm/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2002/06/08 08:36:39 jason Exp $ +# $OpenBSD: Makefile,v 1.2 2003/02/12 07:05:34 mickey Exp $ -SUBDIR+= trivial1 +SUBDIR+= rint trivial1 install: diff --git a/regress/lib/libm/rint/Makefile b/regress/lib/libm/rint/Makefile new file mode 100644 index 00000000000..0b3c1e76ea9 --- /dev/null +++ b/regress/lib/libm/rint/Makefile @@ -0,0 +1,7 @@ +# $OpenBSD: Makefile,v 1.1 2003/02/12 07:05:34 mickey Exp $ + +PROG=rint +LDADD=-lm +DPADD=${LIBM} + +.include <bsd.regress.mk> diff --git a/regress/lib/libm/rint/rint.c b/regress/lib/libm/rint/rint.c new file mode 100644 index 00000000000..5a89861f442 --- /dev/null +++ b/regress/lib/libm/rint/rint.c @@ -0,0 +1,37 @@ +/* $OpenBSD: rint.c,v 1.1 2003/02/12 07:05:34 mickey Exp $ */ + +/* Copyright (c) 2003 Michael Shalayeff. Public domain. */ + +#include <stdio.h> +#include <signal.h> +#include <unistd.h> +#include <math.h> + +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() +{ + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction = sigfpe; + sa.sa_flags = SA_SIGINFO; + sigaction(SIGFPE, &sa, NULL); + + if (rint(8.6) != 9.) + exit(1); + + exit(0); +} |