-# $OpenBSD: Makefile.inc,v 1.7 2005/11/29 21:38:06 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.8 2008/07/24 09:31:06 martynas Exp $
# $NetBSD: Makefile.inc,v 1.3 1995/04/29 05:09:14 cgd Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c \
- modf.c setjmp.S
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.c nan.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= sigsetjmp.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.6 2005/08/07 16:40:13 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.3 2005/08/07 16:40:13 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on an alpha (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0, 0, 0xc0, 0x7f };
-# $OpenBSD: Makefile.inc,v 1.3 2005/11/29 21:38:08 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2008/07/24 09:31:06 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c \
- modf.S setjmp.S sigsetjmp.S
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c setjmp.S \
+ sigsetjmp.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.2 2005/08/07 16:40:13 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.2 2005/08/07 16:40:13 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on an amd64 (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0, 0, 0xc0, 0x7f };
-# $OpenBSD: Makefile.inc,v 1.8 2005/11/29 21:38:08 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.9 2008/07/24 09:31:06 martynas Exp $
# $NetBSD: Makefile.inc,v 1.6 2003/08/01 17:03:47 lukem Exp $
-SRCS+= byte_swap_2.S byte_swap_4.S divsi3.S fabs.c flt_rounds.c infinity.c
-SRCS+= setjmp.S _setjmp.S sigsetjmp.S isinf.c isnan.c modf.c ldexp.c
+SRCS+= byte_swap_2.S byte_swap_4.S divsi3.S fabs.c flt_rounds.c infinity.c \
+ nan.c
+SRCS+= setjmp.S _setjmp.S sigsetjmp.S modf.c ldexp.c
SRCS+= alloca.S
LSRCS+= alloca.c
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.2 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-#include <math.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.2 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-#include <math.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <sys/types.h>
+#include <math.h>
+#include <machine/endian.h>
+
+/* bytes for qNaN on an arm (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+#if BYTE_ORDER == BIG_ENDIAN
+ { 0x7f, 0xc0, 0, 0 };
+#else /* BYTE_ORDER == BIG_ENDIAN */
+ { 0, 0, 0xc0, 0x7f };
+#endif /* BYTE_ORDER == BIG_ENDIAN */
-# $OpenBSD: Makefile.inc,v 1.8 2005/11/29 21:38:08 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.9 2008/07/24 09:31:06 martynas Exp $
SRCS+= setjmp.S
SRCS+= fabs.c ldexp.c
-SRCS+= isnan.c isinf.c infinity.c setjmp.S
+SRCS+= infinity.c nan.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= modf.c
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.4 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.4 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a hppa (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xa0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.2 2005/11/29 21:38:09 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2008/07/24 09:31:06 martynas Exp $
SRCS+= setjmp.S
SRCS+= fabs.c frexp.c ldexp.c
-SRCS+= isnan.c isinf.c infinity.c setjmp.S
+SRCS+= infinity.c nan.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= modf.c
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.2 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.2 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a hppa64 (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xa0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.5 2005/11/29 21:38:09 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $
-SRCS+= _setjmp.S alloca.S fabs.S infinity.c isinf.c isnan.c ldexp.c \
- modf.S setjmp.S sigsetjmp.S
+SRCS+= _setjmp.S alloca.S fabs.S infinity.c ldexp.c \
+ modf.S nan.c setjmp.S sigsetjmp.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.7 2005/08/07 11:30:38 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-#include <math.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.4 2005/08/07 11:30:38 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-#include <math.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on an i386 (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0, 0, 0xc0, 0x7f };
-# $OpenBSD: Makefile.inc,v 1.5 2005/11/29 21:38:09 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.S \
- modf.S setjmp.S sigsetjmp.S
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.S \
+ modf.S nan.c setjmp.S sigsetjmp.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 \
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.6 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.3 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a m68k (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xc0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.5 2005/11/29 21:38:09 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $
# $NetBSD: Makefile.inc,v 1.3 1995/04/10 21:09:06 jtc Exp $
-#SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
+#SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c
#SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
# fpsetround.c fpsetsticky.c
#SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S
-SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c
+SRCS+= _setjmp.S fabs.S frexp.c infinity.c ldexp.c nan.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= setjmp.S sigsetjmp.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.5 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.5 2005/08/07 16:40:14 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a m88k (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xc0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.3 2005/11/29 21:38:09 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2008/07/24 09:31:06 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.S ldexp.S modf.S
+SRCS+= _setjmp.S fabs.S infinity.c isinf.S isnan.S ldexp.S modf.S nan.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= setjmp.S sigsetjmp.S
-/* $OpenBSD: isinf.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */
+/* $OpenBSD: isinf.S,v 1.5 2008/07/24 09:31:06 martynas Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
#define DEXP_INF 0x7ff
/*
- * isnan(x)
- * double x;
- *
- * Return true if x is a NAN.
- */
-LEAF(isnan, 0)
- .set noreorder
- dmfc1 t3, $f12 # get x
- dsll t1, t3, 1 # get x exponent
- dsrl t1, t1, 64 - 11
- bne t1, DEXP_INF, 1f # is it a finite number?
- sll t2, t3, 64 - 52 # get x fraction
- beq t2, zero, 1f # its infinity
- nop
-
- j ra
- li v0, 1 # x is a NAN
-1:
- j ra
- move v0, zero # x is NOT a NAN
-END(isnan)
-
-/*
- * isinf(x)
- * double x;
+ * int
+ * __isinf(double x)
*
* Return true if x is infinity.
*/
-LEAF(isinf, 0)
+LEAF(__isinf, 0)
.set noreorder
dmfc1 t3, $f12 # get LSW of x
dsll t1, t3, 1 # get x exponent
1:
j ra
move v0, zero # x is NOT infinity
-END(isinf)
+END(__isinf)
--- /dev/null
+/* $OpenBSD: isnan.S,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * 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. 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.
+ */
+
+#include <machine/asm.h>
+
+#define DEXP_INF 0x7ff
+
+/*
+ * int
+ * __isnan(double x)
+ *
+ * Return true if x is a NAN.
+ */
+LEAF(__isnan, 0)
+ .set noreorder
+ dmfc1 t3, $f12 # get x
+ dsll t1, t3, 1 # get x exponent
+ dsrl t1, t1, 64 - 11
+ bne t1, DEXP_INF, 1f # is it a finite number?
+ sll t2, t3, 64 - 52 # get x fraction
+ beq t2, zero, 1f # its infinity
+ nop
+
+ j ra
+ li v0, 1 # x is a NAN
+1:
+ j ra
+ move v0, zero # x is NOT a NAN
+END(__isnan)
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <sys/types.h>
+#include <math.h>
+#include <machine/endian.h>
+
+/* bytes for qNaN on a mips64 (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+#if BYTE_ORDER == BIG_ENDIAN
+ { 0x7f, 0xa0, 0, 0 };
+#else /* BYTE_ORDER == BIG_ENDIAN */
+ { 0, 0, 0xa0, 0x7f };
+#endif /* BYTE_ORDER == BIG_ENDIAN */
-SRCS+= isinf.c isnan.c infinity.c setjmp.S sigsetjmp.S flt_rounds.c modf.c
+SRCS+= infinity.c setjmp.S sigsetjmp.S flt_rounds.c modf.c nan.c
SRCS+= ldexp.c fabs.c
SRCS+= fpgetmask.c fpsetmask.c
SRCS+= fpgetround.c fpsetround.c
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.6 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.3 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a powerpc (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xc0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.5 2007/03/02 06:11:54 miod Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $
-SRCS+= flt_rounds.c isinf.c isnan.c infinity.c setjmp.S _setjmp.S sigsetjmp.S \
+SRCS+= flt_rounds.c infinity.c nan.c setjmp.S _setjmp.S sigsetjmp.S \
modf.c ldexp.c
SRCS+= fabs.c fpgetmask.c fpgetround.c fpgetsticky.c \
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.1.1.1 2006/10/10 22:07:10 miod 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.1.1.1 2006/10/10 22:07:10 miod 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <sys/types.h>
+#include <math.h>
+#include <machine/endian.h>
+
+/* bytes for qNaN on a sh (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+#if BYTE_ORDER == BIG_ENDIAN
+ { 0x7f, 0xa0, 0, 0 };
+#else /* BYTE_ORDER == BIG_ENDIAN */
+ { 0, 0, 0xa0, 0x7f };
+#endif /* BYTE_ORDER == BIG_ENDIAN */
-# $OpenBSD: Makefile.inc,v 1.5 2005/11/29 21:38:10 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.6 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.6 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a sparc (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xc0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.4 2005/11/29 21:38:10 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2008/07/24 09:31:07 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S
+++ /dev/null
-/* $OpenBSD: isinf.c,v 1.4 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isinf(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- p->dbl_frach == 0 && p->dbl_fracl == 0);
-}
+++ /dev/null
-/* $OpenBSD: isnan.c,v 1.4 2005/08/07 16:40:15 espie 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. 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.
- */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-int
-isnan(d)
- double d;
-{
- struct ieee_double *p = (struct ieee_double *)&d;
-
- return (p->dbl_exp == DBL_EXP_INFNAN &&
- (p->dbl_frach != 0 || p->dbl_fracl != 0));
-}
--- /dev/null
+/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+
+/* Written by Martynas Venckus. Public Domain. */
+
+#include <math.h>
+
+/* bytes for qNaN on a sparc64 (IEEE single format) */
+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
+ { 0x7f, 0xc0, 0, 0 };
-# $OpenBSD: Makefile.inc,v 1.5 2005/11/29 21:38:10 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:07 martynas Exp $
-SRCS+= _setjmp.S fabs.S infinity.c isinf.c ldexp.S \
+SRCS+= _setjmp.S fabs.S infinity.c ldexp.S \
modf.S setjmp.S udiv.S urem.S sigsetjmp.S
SRCS+= alloca.S
--- /dev/null
+/* $OpenBSD: fpclassify.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <machine/vaxfp.h>
+#include <math.h>
+
+int
+__fpclassify(double d)
+{
+ struct vax_d_floating *p = (struct vax_d_floating *)&d;
+
+ if (p->dflt_exp == 0) {
+ return FP_ZERO;
+ }
+
+ return FP_NORMAL;
+}
+
+int
+__fpclassifyf(float f)
+{
+ struct vax_f_floating *p = (struct vax_f_floating *)&f;
+
+ if (p->fflt_exp == 0) {
+ return FP_ZERO;
+ }
+
+ return FP_NORMAL;
+}
--- /dev/null
+/* $OpenBSD: isfinite.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ARGSUSED */
+int
+__isfinite(double d)
+{
+ return(1);
+}
+
+/* ARGSUSED */
+int
+__isfinitef(float f)
+{
+ return(1);
+}
-/* $OpenBSD: isinf.c,v 1.6 2005/08/07 16:40:15 espie Exp $ */
+/* $OpenBSD: isinf.c,v 1.7 2008/07/24 09:31:07 martynas Exp $ */
/*-
* Copyright (c) 1991, 1993
/* ARGSUSED */
int
-isnan(d)
- double d;
+__isinf(double d)
{
return(0);
}
/* ARGSUSED */
int
-isinf(d)
- double d;
+isinff(float f)
{
return(0);
}
--- /dev/null
+/* $OpenBSD: isnan.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ARGSUSED */
+int
+__isnan(double d)
+{
+ return(0);
+}
+
+/* ARGSUSED */
+int
+isnanf(float f)
+{
+ return(0);
+}
--- /dev/null
+/* $OpenBSD: isnormal.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <machine/vaxfp.h>
+
+int
+__isnormal(double d)
+{
+ struct vax_d_floating *p = (struct vax_d_floating *)&d;
+
+ return (p->dflt_exp != 0);
+}
+
+int
+__isnormalf(float f)
+{
+ struct vax_f_floating *p = (struct vax_f_floating *)&f;
+
+ return (p->fflt_exp != 0);
+}
--- /dev/null
+/* $OpenBSD: signbit.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <machine/vaxfp.h>
+
+int
+__signbit(double d)
+{
+ struct vax_d_floating *p = (struct vax_d_floating *)&d;
+
+ return p->dflt_sign;
+}
+
+int
+__signbitf(float f)
+{
+ struct vax_f_floating *p = (struct vax_f_floating *)&f;
+
+ return p->fflt_sign;
+}
-# $OpenBSD: Makefile.inc,v 1.41 2008/06/24 14:27:24 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.42 2008/07/24 09:31:07 martynas Exp $
# gen sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/gen ${LIBCSRCDIR}/gen
SRCS+= alarm.c assert.c auth_subr.c authenticate.c \
basename.c clock.c closedir.c confstr.c ctermid.c ctype_.c \
daemon.c devname.c dirname.c disklabel.c elf_hash.c err.c \
- errx.c errlist.c errno.c exec.c fnmatch.c frexp.c fstab.c ftok.c \
- fts.c ftw.c getbsize.c getcap.c getcwd.c getdomainname.c \
- getgrent.c getgrouplist.c gethostname.c getloadavg.c \
- getlogin.c getmntinfo.c getnetgrent.c getpagesize.c getpwent.c \
- getttyent.c getusershell.c glob.c initgroups.c isatty.c \
- isctype.c isfdtype.c lockf.c login_cap.c nice.c nlist.c \
+ errx.c errlist.c errno.c exec.c fnmatch.c fpclassify.c frexp.c \
+ fstab.c ftok.c fts.c ftw.c getbsize.c getcap.c getcwd.c \
+ getdomainname.c getgrent.c getgrouplist.c gethostname.c \
+ getloadavg.c getlogin.c getmntinfo.c getnetgrent.c getpagesize.c \
+ getpwent.c getttyent.c getusershell.c glob.c initgroups.c \
+ isatty.c isctype.c isfdtype.c isfinite.c isinf.c isnan.c \
+ isnormal.c signbit.c lockf.c login_cap.c nice.c nlist.c \
nftw.c opendir.c pause.c popen.c psignal.c pw_dup.c pwcache.c \
raise.c readdir.c readpassphrase.c rewinddir.c scandir.c \
seekdir.c setdomainname.c sethostname.c setjmperr.c setmode.c \
# machine-dependent gen sources
# m-d Makefile.inc must include sources for:
-# _setjmp() fabs() frexp() infinity isinf() ldexp() modf()
+# _setjmp() fabs() frexp() infinity ldexp() modf() nan
# setjmp() sigsetjmp()
.include "${LIBCSRCDIR}/arch/${MACHINE_ARCH}/gen/Makefile.inc"
--- /dev/null
+/* $OpenBSD: fpclassify.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+#include <math.h>
+
+int
+__fpclassify(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ if (p->dbl_exp == 0) {
+ if (p->dbl_frach == 0 && p->dbl_fracl == 0)
+ return FP_ZERO;
+ else
+ return FP_SUBNORMAL;
+ }
+
+ if (p->dbl_exp == DBL_EXP_INFNAN) {
+ if (p->dbl_frach == 0 && p->dbl_fracl == 0)
+ return FP_INFINITE;
+ else
+ return FP_NAN;
+ }
+
+ return FP_NORMAL;
+}
+
+int
+__fpclassifyf(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ if (p->sng_exp == 0) {
+ if (p->sng_frac == 0)
+ return FP_ZERO;
+ else
+ return FP_SUBNORMAL;
+ }
+
+ if (p->sng_exp == SNG_EXP_INFNAN) {
+ if (p->sng_frac == 0)
+ return FP_INFINITE;
+ else
+ return FP_NAN;
+ }
+
+ return FP_NORMAL;
+}
+
+#if 0 /* XXX */
+int
+__fpclassifyl(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ if (p->ext_exp == 0) {
+ if (p->ext_frach == 0 && p->ext_fracl == 0)
+ return FP_ZERO;
+ else
+ return FP_SUBNORMAL;
+ }
+
+ p->ext_frach &= ~0x80000000; /* clear sign bit */
+
+ if (p->ext_exp == EXT_EXP_INFNAN) {
+ if (p->ext_frach == 0 && p->ext_fracl == 0)
+ return FP_INFINITE;
+ else
+ return FP_NAN;
+ }
+
+ return FP_NORMAL;
+}
+#endif /* XXX */
--- /dev/null
+/* $OpenBSD: isfinite.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+
+int
+__isfinite(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ return (p->dbl_exp != DBL_EXP_INFNAN);
+}
+
+int
+__isfinitef(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ return (p->sng_exp != SNG_EXP_INFNAN);
+}
+
+#if 0 /* XXX */
+int
+__isfinitel(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ return (p->ext_exp != EXT_EXP_INFNAN);
+}
+#endif /* XXX */
--- /dev/null
+/* $OpenBSD: isinf.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+
+int
+__isinf(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ return (p->dbl_exp == DBL_EXP_INFNAN &&
+ p->dbl_frach == 0 && p->dbl_fracl == 0);
+}
+
+int
+isinff(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac == 0);
+}
+
+#if 0 /* XXX */
+int
+__isinfl(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ p->ext_frach &= ~0x80000000; /* clear sign bit */
+
+ return (p->ext_exp == EXT_EXP_INFNAN &&
+ p->ext_frach == 0 && p->ext_fracl == 0);
+}
+#endif /* XXX */
--- /dev/null
+/* $OpenBSD: isnan.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+
+int
+__isnan(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ return (p->dbl_exp == DBL_EXP_INFNAN &&
+ (p->dbl_frach != 0 || p->dbl_fracl != 0));
+}
+
+int
+isnanf(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac != 0);
+}
+
+#if 0 /* XXX */
+int
+__isnanl(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ p->ext_frach &= ~0x80000000; /* clear sign bit */
+
+ return (p->ext_exp == EXT_EXP_INFNAN &&
+ (p->ext_frach != 0 || p->ext_fracl != 0));
+}
+#endif /* XXX */
--- /dev/null
+/* $OpenBSD: isnormal.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+
+int
+__isnormal(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ return (p->dbl_exp != 0 && p->dbl_exp != DBL_EXP_INFNAN);
+}
+
+int
+__isnormalf(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ return (p->sng_exp != 0 && p->sng_exp != SNG_EXP_INFNAN);
+}
+
+#if 0 /* XXX */
+int
+__isnormall(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ return (p->ext_exp != 0 && p->ext_exp != EXT_EXP_INFNAN);
+}
+#endif /* XXX */
--- /dev/null
+/* $OpenBSD: signbit.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+
+int
+__signbit(double d)
+{
+ struct ieee_double *p = (struct ieee_double *)&d;
+
+ return p->dbl_sign;
+}
+
+int
+__signbitf(float f)
+{
+ struct ieee_single *p = (struct ieee_single *)&f;
+
+ return p->sng_sign;
+}
+
+#if 0 /* XXX */
+int
+__signbitl(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ return p->ext_sign;
+}
+#endif /* XXX */
-major=47
+major=48
minor=0
# note: If changes were made to include/thread_private.h or if system
# calls were added/changed then libpthread must also be updated.