Add a not-a-number test, based on Ben Harris's infinity test.

Disabled on vax.
This commit is contained in:
simonb 2001-10-28 10:41:56 +00:00
parent 87746219bd
commit d2544ca8eb
3 changed files with 42 additions and 1 deletions

View File

@ -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 <bsd.subdir.mk>

View File

@ -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 <bsd.prog.mk>

View File

@ -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 <err.h>
#include <math.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
/* NAN is meant to be an infinity. */
if (!isnan(NAN))
errx(1, "NAN is a number");
return 0;
}