Separate isnan() into a separate module, and make isinf()/isnan() use ieee.h.

This commit is contained in:
mycroft 1999-08-29 18:08:27 +00:00
parent f91881f24a
commit 17030e8106
18 changed files with 408 additions and 143 deletions

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile.inc,v 1.5 1999/01/15 13:31:15 bouyer Exp $
# $NetBSD: Makefile.inc,v 1.6 1999/08/29 18:08:27 mycroft Exp $
SRCS+= fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c
SRCS+= fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= _setjmp.S

View File

@ -1,52 +1,62 @@
/* $NetBSD: isinf.c,v 1.3 1998/11/14 19:31:01 christos Exp $ */
/* $NetBSD: isinf.c,v 1.4 1999/08/29 18:08:28 mycroft Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.4 1999/08/29 18:08:28 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
__weak_alias(isinf,_isinf);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach || p->dbl_fracl));
}
int
isinf(d)
double d;
@ -54,5 +64,5 @@ isinf(d)
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
!p->dbl_frach && !p->dbl_fracl);
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -0,0 +1,68 @@
/* $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:28 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.1 1999/08/29 18:08:28 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));
}

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile.inc,v 1.6 1999/01/15 13:31:16 bouyer Exp $
# $NetBSD: Makefile.inc,v 1.7 1999/08/29 18:08:29 mycroft Exp $
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
fabs.c flt_rounds.c fpgetround.c fpsetround.c \
fpgetmask.S fpsetmask.S fpgetsticky.S fpsetsticky.S \
infinity.c isinf.c frexp.c ldexp.c modf.c
infinity.c isinf.c isnan.c frexp.c ldexp.c modf.c
SRCS+= setjmp.S __setjmp14.S
SRCS+= _setjmp.S

View File

@ -1,7 +1,12 @@
/* $NetBSD: isinf.c,v 1.5 1998/11/14 19:31:01 christos Exp $ */
/* $NetBSD: isinf.c,v 1.6 1999/08/29 18:08:29 mycroft Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -13,16 +18,16 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD project.
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -30,32 +35,34 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.6 1999/08/29 18:08:29 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
__weak_alias(isinf,_isinf);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return(p->dbl_exp == DBL_EXP_INFNAN && (p->dbl_frach || p->dbl_fracl));
}
int
isinf(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return(p->dbl_exp == DBL_EXP_INFNAN && !p->dbl_frach && !p->dbl_fracl);
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -0,0 +1,68 @@
/* $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:29 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.1 1999/08/29 18:08:29 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));
}

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.7 1999/01/15 13:31:17 bouyer Exp $
# $NetBSD: Makefile.inc,v 1.8 1999/08/29 18:08:30 mycroft Exp $
# objects built from assembler sources (need lint stubs)
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S modf.S \
@ -10,7 +10,7 @@ SRCS+= _setjmp.S
SRCS+= sigsetjmp.S __sigsetjmp14.S
# objects built from C sources
SRCS+= bswap64.c frexp.c infinity.c isinf.c ldexp.c
SRCS+= bswap64.c frexp.c infinity.c isinf.c isnan.c ldexp.c
# "internal" objects (don't provide part of the user-visible API)
SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S

View File

@ -1,8 +1,12 @@
/* $NetBSD: isinf.c,v 1.5 1998/11/14 19:31:01 christos Exp $ */
/* $NetBSD: isinf.c,v 1.6 1999/08/29 18:08:30 mycroft Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -31,50 +35,34 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 5.1 (Berkeley) 3/18/91";
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.5 1998/11/14 19:31:01 christos Exp $");
__RCSID("$NetBSD: isinf.c,v 1.6 1999/08/29 18:08:30 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
__weak_alias(isinf,_isinf);
#endif
int
isnan(d)
double d;
{
register struct IEEEdp {
u_int manl : 32;
u_int manh : 20;
u_int exp : 11;
u_int sign : 1;
} *p = (struct IEEEdp *)(void *)&d;
return(p->exp == 2047 && (p->manh || p->manl));
}
int
isinf(d)
double d;
{
register struct IEEEdp {
u_int manl : 32;
u_int manh : 20;
u_int exp : 11;
u_int sign : 1;
} *p = (struct IEEEdp *)(void *)&d;
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return(p->exp == 2047 && !p->manh && !p->manl);
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -0,0 +1,68 @@
/* $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:30 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.1 1999/08/29 18:08:30 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));
}

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile.inc,v 1.9 1999/01/15 13:31:18 bouyer Exp $
# $NetBSD: Makefile.inc,v 1.10 1999/08/29 18:08:30 mycroft Exp $
SRCS+= alloca.S fabs.S frexp.c infinity.c isinf.c modf.S
SRCS+= alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c modf.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \

View File

@ -1,8 +1,12 @@
/* $NetBSD: isinf.c,v 1.6 1998/11/14 19:31:01 christos Exp $ */
/* $NetBSD: isinf.c,v 1.7 1999/08/29 18:08:30 mycroft Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -31,50 +35,34 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)isinf.c 5.1 (Berkeley) 3/18/91";
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.6 1998/11/14 19:31:01 christos Exp $");
__RCSID("$NetBSD: isinf.c,v 1.7 1999/08/29 18:08:30 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
__weak_alias(isinf,_isinf);
#endif
int
isnan(d)
double d;
{
register struct IEEEdp {
u_int sign : 1;
u_int exp : 11;
u_int manh : 20;
u_int manl : 32;
} *p = (struct IEEEdp *)(void *)&d;
return(p->exp == 2047 && (p->manh || p->manl));
}
int
isinf(d)
double d;
{
register struct IEEEdp {
u_int sign : 1;
u_int exp : 11;
u_int manh : 20;
u_int manl : 32;
} *p = (struct IEEEdp *)(void *)&d;
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return(p->exp == 2047 && !p->manh && !p->manl);
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -0,0 +1,68 @@
/* $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:30 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.1 1999/08/29 18:08:30 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
#endif
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isinf.c,v 1.4 1998/11/14 19:31:02 christos Exp $ */
/* $NetBSD: isinf.c,v 1.5 1999/08/29 18:08:31 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.4 1998/11/14 19:31:02 christos Exp $");
__RCSID("$NetBSD: isinf.c,v 1.5 1999/08/29 18:08:31 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -64,5 +64,5 @@ isinf(d)
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
p->dbl_frach == 0 && p->dbl_fracl == 0);
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isnan.c,v 1.3 1998/10/13 14:43:38 kleink Exp $ */
/* $NetBSD: isnan.c,v 1.4 1999/08/29 18:08:31 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -36,15 +36,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isnan.c,v 1.1 91/07/08 19:03:34 torek Exp
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isnan.c 8.1 (Berkeley) 6/4/93";
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.3 1998/10/13 14:43:38 kleink Exp $");
__RCSID("$NetBSD: isnan.c,v 1.4 1999/08/29 18:08:31 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -61,7 +61,7 @@ int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));

View File

@ -1,4 +1,4 @@
/* $NetBSD: isinf.c,v 1.5 1998/11/14 19:31:02 christos Exp $ */
/* $NetBSD: isinf.c,v 1.6 1999/08/29 18:08:31 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,14 +44,14 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.5 1998/11/14 19:31:02 christos Exp $");
__RCSID("$NetBSD: isinf.c,v 1.6 1999/08/29 18:08:31 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <math.h>
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isinf,_isinf);
@ -64,5 +64,5 @@ isinf(d)
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
p->dbl_frach == 0 && p->dbl_fracl == 0);
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isnan.c,v 1.4 1998/10/13 14:43:38 kleink Exp $ */
/* $NetBSD: isnan.c,v 1.5 1999/08/29 18:08:31 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -36,22 +36,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isnan.c,v 1.1 91/07/08 19:03:34 torek Exp
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isnan.c 8.1 (Berkeley) 6/4/93";
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.4 1998/10/13 14:43:38 kleink Exp $");
__RCSID("$NetBSD: isnan.c,v 1.5 1999/08/29 18:08:31 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <math.h>
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
@ -61,7 +61,7 @@ int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));

View File

@ -1,4 +1,4 @@
/* $NetBSD: isinf.c,v 1.3 1998/11/14 19:31:02 christos Exp $ */
/* $NetBSD: isinf.c,v 1.4 1999/08/29 18:08:32 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,14 +44,14 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinf.c,v 1.3 1998/11/14 19:31:02 christos Exp $");
__RCSID("$NetBSD: isinf.c,v 1.4 1999/08/29 18:08:32 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <math.h>
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isinf,_isinf);
@ -64,5 +64,5 @@ isinf(d)
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
p->dbl_frach == 0 && p->dbl_fracl == 0);
(p->dbl_frach == 0 && p->dbl_fracl == 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isnan.c,v 1.2 1998/10/13 14:43:38 kleink Exp $ */
/* $NetBSD: isnan.c,v 1.3 1999/08/29 18:08:32 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -36,22 +36,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isnan.c,v 1.1 91/07/08 19:03:34 torek Exp
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)isnan.c 8.1 (Berkeley) 6/4/93";
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnan.c,v 1.2 1998/10/13 14:43:38 kleink Exp $");
__RCSID("$NetBSD: isnan.c,v 1.3 1999/08/29 18:08:32 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <math.h>
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
#ifdef __weak_alias
__weak_alias(isnan,_isnan);
@ -61,7 +61,7 @@ int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));