From d2544ca8ebdd8bbd944e47b2dd3a0c2062ac1c80 Mon Sep 17 00:00:00 2001 From: simonb Date: Sun, 28 Oct 2001 10:41:56 +0000 Subject: [PATCH] Add a not-a-number test, based on Ben Harris's infinity test. Disabled on vax. --- regress/lib/libc/ieeefp/Makefile | 6 +++++- regress/lib/libc/ieeefp/nan/Makefile | 9 +++++++++ regress/lib/libc/ieeefp/nan/nan.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 regress/lib/libc/ieeefp/nan/Makefile create mode 100644 regress/lib/libc/ieeefp/nan/nan.c diff --git a/regress/lib/libc/ieeefp/Makefile b/regress/lib/libc/ieeefp/Makefile index 7c1063c58c35..35d1bc1df022 100644 --- a/regress/lib/libc/ieeefp/Makefile +++ b/regress/lib/libc/ieeefp/Makefile @@ -1,7 +1,11 @@ -# $NetBSD: Makefile,v 1.9 2001/10/27 23:36:32 bjh21 Exp $ +# $NetBSD: Makefile,v 1.10 2001/10/28 10:41:56 simonb Exp $ # Don't hook up testfloat just yet. (ross, 2001.3.12) SUBDIR+= except infinity round +.if ${MACHINE} != "vax" +SUBDIR+= nan +.endif + .include diff --git a/regress/lib/libc/ieeefp/nan/Makefile b/regress/lib/libc/ieeefp/nan/Makefile new file mode 100644 index 000000000000..9381fcaa6406 --- /dev/null +++ b/regress/lib/libc/ieeefp/nan/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2001/10/28 10:41:56 simonb Exp $ + +PROG= nan +MKMAN= no + +regress: ${PROG} + ./${PROG} + +.include diff --git a/regress/lib/libc/ieeefp/nan/nan.c b/regress/lib/libc/ieeefp/nan/nan.c new file mode 100644 index 000000000000..a38db3dfc54a --- /dev/null +++ b/regress/lib/libc/ieeefp/nan/nan.c @@ -0,0 +1,28 @@ +/* $NetBSD: nan.c,v 1.1 2001/10/28 10:41:56 simonb Exp $ */ + +/* + * This file is in the Public Domain. + * + * Blatently copied from the infinity test by Ben Harris. + * + * Simon Burge, 2001 + */ + +/* + * Check that NAN (alias __nanf) really is not-a-number. + * Alternatively, check that isnan() minimally works. + */ + +#include +#include +#include + +int +main(int argc, char **argv) +{ + + /* NAN is meant to be an infinity. */ + if (!isnan(NAN)) + errx(1, "NAN is a number"); + return 0; +}