summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authormiod <>2004-01-15 18:53:24 +0000
committermiod <>2004-01-15 18:53:24 +0000
commitb4594fd38896c2ffb37c430cb680d9a4a2c6ad0d (patch)
tree78f778214dbc465eaed1d49a55652ddf4e8e2c93 /src/regress/lib
parentc1bb64f8042660ab47b0a566fa595b844e3da388 (diff)
downloadopenbsd-b4594fd38896c2ffb37c430cb680d9a4a2c6ad0d.tar.gz
openbsd-b4594fd38896c2ffb37c430cb680d9a4a2c6ad0d.tar.bz2
openbsd-b4594fd38896c2ffb37c430cb680d9a4a2c6ad0d.zip
Add a new regression test, which checks that we handle fp overflow correctly,
and produce a correct infinity. Currently, this tests fails on 68060 (060sp is to blame) and 88100 processors, and maybe more.
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libc/ieeefp/Makefile4
-rw-r--r--src/regress/lib/libc/ieeefp/infinity/Makefile9
-rw-r--r--src/regress/lib/libc/ieeefp/infinity/infinity.c32
3 files changed, 43 insertions, 2 deletions
diff --git a/src/regress/lib/libc/ieeefp/Makefile b/src/regress/lib/libc/ieeefp/Makefile
index f9a6035fa9..89ff51a2e7 100644
--- a/src/regress/lib/libc/ieeefp/Makefile
+++ b/src/regress/lib/libc/ieeefp/Makefile
@@ -1,7 +1,7 @@
1# $OpenBSD: Makefile,v 1.5 2002/02/23 01:25:11 art Exp $ 1# $OpenBSD: Makefile,v 1.6 2004/01/15 18:53:23 miod Exp $
2# $NetBSD: Makefile,v 1.5 1996/04/09 16:54:18 phil Exp $ 2# $NetBSD: Makefile,v 1.5 1996/04/09 16:54:18 phil Exp $
3 3
4SUBDIR+= except inf round 4SUBDIR+= except inf infinity round
5 5
6install: 6install:
7 7
diff --git a/src/regress/lib/libc/ieeefp/infinity/Makefile b/src/regress/lib/libc/ieeefp/infinity/Makefile
new file mode 100644
index 0000000000..a593fcf37d
--- /dev/null
+++ b/src/regress/lib/libc/ieeefp/infinity/Makefile
@@ -0,0 +1,9 @@
1# $OpenBSD: Makefile,v 1.1 2004/01/15 18:53:24 miod Exp $
2
3PROG= infinity
4SRCS= infinity.c
5
6DPADD+= ${LIBM}
7LDADD+= -lm
8
9.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/ieeefp/infinity/infinity.c b/src/regress/lib/libc/ieeefp/infinity/infinity.c
new file mode 100644
index 0000000000..0f60b4762b
--- /dev/null
+++ b/src/regress/lib/libc/ieeefp/infinity/infinity.c
@@ -0,0 +1,32 @@
1/* $OpenBSD: infinity.c,v 1.1 2004/01/15 18:53:24 miod Exp $ */
2/*
3 * Written by Miodrag Vallat, 2004 - Public Domain
4 * Inspired from Perl's t/op/arith test #134
5 */
6
7#include <math.h>
8#include <signal.h>
9
10void
11sigfpe(int signum)
12{
13 /* looks like we don't handle fp overflow correctly... */
14 _exit(1);
15}
16
17int
18main(int argc, char *argv[])
19{
20 double d, u;
21 int i;
22
23 signal(SIGFPE, sigfpe);
24
25 d = 1.0;
26 for (i = 2000; i != 0; i--) {
27 d = d * 2.0;
28 }
29
30 /* result should be _positive_ infinity */
31 return ((isinf(d) && copysign(1.0, d) > 0.0) ? 0 : 1);
32}