From b4594fd38896c2ffb37c430cb680d9a4a2c6ad0d Mon Sep 17 00:00:00 2001 From: miod <> Date: Thu, 15 Jan 2004 18:53:24 +0000 Subject: 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. --- src/regress/lib/libc/ieeefp/Makefile | 4 ++-- src/regress/lib/libc/ieeefp/infinity/Makefile | 9 +++++++ src/regress/lib/libc/ieeefp/infinity/infinity.c | 32 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/regress/lib/libc/ieeefp/infinity/Makefile create mode 100644 src/regress/lib/libc/ieeefp/infinity/infinity.c (limited to 'src') 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 @@ -# $OpenBSD: Makefile,v 1.5 2002/02/23 01:25:11 art Exp $ +# $OpenBSD: Makefile,v 1.6 2004/01/15 18:53:23 miod Exp $ # $NetBSD: Makefile,v 1.5 1996/04/09 16:54:18 phil Exp $ -SUBDIR+= except inf round +SUBDIR+= except inf infinity round install: 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 @@ +# $OpenBSD: Makefile,v 1.1 2004/01/15 18:53:24 miod Exp $ + +PROG= infinity +SRCS= infinity.c + +DPADD+= ${LIBM} +LDADD+= -lm + +.include 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 @@ +/* $OpenBSD: infinity.c,v 1.1 2004/01/15 18:53:24 miod Exp $ */ +/* + * Written by Miodrag Vallat, 2004 - Public Domain + * Inspired from Perl's t/op/arith test #134 + */ + +#include +#include + +void +sigfpe(int signum) +{ + /* looks like we don't handle fp overflow correctly... */ + _exit(1); +} + +int +main(int argc, char *argv[]) +{ + double d, u; + int i; + + signal(SIGFPE, sigfpe); + + d = 1.0; + for (i = 2000; i != 0; i--) { + d = d * 2.0; + } + + /* result should be _positive_ infinity */ + return ((isinf(d) && copysign(1.0, d) > 0.0) ? 0 : 1); +} -- cgit v1.2.3-55-g6feb