summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-02-01 15:12:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-02-01 15:12:31 +0000
commit1b0c2756f2ed59c98af0244f8e4bc953aa86d9d5 (patch)
tree5f0e1cf4c46cc06d7847c4dc9c5161018e757400 /lib/libc
parent7f1209ff29fd072e2f8d1f49392e63d47962736b (diff)
Replace broken frexp() with a working one from FreeBSD. There's
no need to have a copy for each platform with ieee floating point, only vax needs a special version (which probably has similar bugs). OK and with help from otto@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/alpha/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/alpha/gen/frexp.c74
-rw-r--r--lib/libc/arch/amd64/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/amd64/gen/frexp.c74
-rw-r--r--lib/libc/arch/arm/gen/Makefile.inc3
-rw-r--r--lib/libc/arch/arm/gen/frexp.c74
-rw-r--r--lib/libc/arch/hppa/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/hppa/gen/frexp.c74
-rw-r--r--lib/libc/arch/i386/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/m68k/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/m68k/gen/frexp.c74
-rw-r--r--lib/libc/arch/m88k/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/m88k/gen/frexp.c74
-rw-r--r--lib/libc/arch/mips64/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/mips64/gen/frexp.c74
-rw-r--r--lib/libc/arch/powerpc/gen/Makefile.inc2
-rw-r--r--lib/libc/arch/powerpc/gen/frexp.c74
-rw-r--r--lib/libc/arch/sparc/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/sparc/gen/frexp.c74
-rw-r--r--lib/libc/arch/sparc64/gen/Makefile.inc4
-rw-r--r--lib/libc/arch/sparc64/gen/frexp.c74
-rw-r--r--lib/libc/arch/vax/gen/Makefile.inc4
-rw-r--r--lib/libc/gen/Makefile.inc4
-rw-r--r--lib/libc/gen/frexp.c (renamed from lib/libc/arch/i386/gen/frexp.c)67
24 files changed, 55 insertions, 801 deletions
diff --git a/lib/libc/arch/alpha/gen/Makefile.inc b/lib/libc/arch/alpha/gen/Makefile.inc
index 67af127a822..2374fd6135b 100644
--- a/lib/libc/arch/alpha/gen/Makefile.inc
+++ b/lib/libc/arch/alpha/gen/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.5 2003/05/02 19:20:26 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2005/02/01 15:12:28 millert Exp $
# $NetBSD: Makefile.inc,v 1.3 1995/04/29 05:09:14 cgd Exp $
-SRCS+= _setjmp.S alloca.c fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c \
+SRCS+= _setjmp.S alloca.c fabs.S infinity.c isinf.c isnan.c ldexp.c \
modf.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
diff --git a/lib/libc/arch/alpha/gen/frexp.c b/lib/libc/arch/alpha/gen/frexp.c
deleted file mode 100644
index 3ec9b3268d0..00000000000
--- a/lib/libc/arch/alpha/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.6 2003/06/02 20:18:30 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.6 2003/06/02 20:18:30 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/amd64/gen/Makefile.inc b/lib/libc/arch/amd64/gen/Makefile.inc
index a150d95eba0..ce3aa3285c4 100644
--- a/lib/libc/arch/amd64/gen/Makefile.inc
+++ b/lib/libc/arch/amd64/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $
+# $OpenBSD: Makefile.inc,v 1.2 2005/02/01 15:12:29 millert Exp $
-SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c \
+SRCS+= _setjmp.S alloca.S fabs.S infinity.c isinf.c isnan.c ldexp.c \
modf.S setjmp.S sigsetjmp.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
diff --git a/lib/libc/arch/amd64/gen/frexp.c b/lib/libc/arch/amd64/gen/frexp.c
deleted file mode 100644
index bc84467fa9e..00000000000
--- a/lib/libc/arch/amd64/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/arm/gen/Makefile.inc b/lib/libc/arch/arm/gen/Makefile.inc
index 562aed7bd86..01c013f85f3 100644
--- a/lib/libc/arch/arm/gen/Makefile.inc
+++ b/lib/libc/arch/arm/gen/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.6 2004/02/03 16:45:35 drahn Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2005/02/01 15:12:29 millert Exp $
# $NetBSD: Makefile.inc,v 1.6 2003/08/01 17:03:47 lukem Exp $
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S divsi3.S \
@@ -13,4 +13,3 @@ SRCS+= isinf.c isnan.c
SRCS+= modf.c
SRCS+= ldexp.c
-SRCS+= frexp.c
diff --git a/lib/libc/arch/arm/gen/frexp.c b/lib/libc/arch/arm/gen/frexp.c
deleted file mode 100644
index 224b643285a..00000000000
--- a/lib/libc/arch/arm/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.1 2004/02/02 16:09:45 drahn 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2004/02/02 16:09:45 drahn Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/hppa/gen/Makefile.inc b/lib/libc/arch/hppa/gen/Makefile.inc
index e59f0cd20ff..84702caffb7 100644
--- a/lib/libc/arch/hppa/gen/Makefile.inc
+++ b/lib/libc/arch/hppa/gen/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.6 2003/05/02 19:20:26 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2005/02/01 15:12:29 millert Exp $
SRCS+= setjmp.S
-SRCS+= fabs.c frexp.c ldexp.c
+SRCS+= fabs.c ldexp.c
SRCS+= isnan.c isinf.c infinity.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
diff --git a/lib/libc/arch/hppa/gen/frexp.c b/lib/libc/arch/hppa/gen/frexp.c
deleted file mode 100644
index f586d4a77b5..00000000000
--- a/lib/libc/arch/hppa/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.2 2003/06/02 20:18:30 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.2 2003/06/02 20:18:30 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/i386/gen/Makefile.inc b/lib/libc/arch/i386/gen/Makefile.inc
index b8b14e53258..07d92a37cda 100644
--- a/lib/libc/arch/i386/gen/Makefile.inc
+++ b/lib/libc/arch/i386/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.3 2001/09/10 22:38:11 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2005/02/01 15:12:29 millert Exp $
-SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c \
+SRCS+= _setjmp.S alloca.S fabs.S infinity.c isinf.c isnan.c ldexp.c \
modf.S setjmp.S sigsetjmp.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
diff --git a/lib/libc/arch/m68k/gen/Makefile.inc b/lib/libc/arch/m68k/gen/Makefile.inc
index 7a58c3e63ae..bb2bac9502d 100644
--- a/lib/libc/arch/m68k/gen/Makefile.inc
+++ b/lib/libc/arch/m68k/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.3 2001/09/10 22:38:11 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2005/02/01 15:12:29 millert Exp $
-SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.S \
+SRCS+= _setjmp.S alloca.S fabs.S infinity.c isinf.c isnan.c ldexp.S \
modf.S setjmp.S sigsetjmp.S
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
fpsetround.S fpsetsticky.S
diff --git a/lib/libc/arch/m68k/gen/frexp.c b/lib/libc/arch/m68k/gen/frexp.c
deleted file mode 100644
index fda0547c46e..00000000000
--- a/lib/libc/arch/m68k/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:31 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:31 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/m88k/gen/Makefile.inc b/lib/libc/arch/m88k/gen/Makefile.inc
index a21dd5d2966..254cfe01b04 100644
--- a/lib/libc/arch/m88k/gen/Makefile.inc
+++ b/lib/libc/arch/m88k/gen/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.3 2003/05/02 19:20:26 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2005/02/01 15:12:29 millert Exp $
# $NetBSD: Makefile.inc,v 1.3 1995/04/10 21:09:06 jtc Exp $
-#SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
+#SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
#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
diff --git a/lib/libc/arch/m88k/gen/frexp.c b/lib/libc/arch/m88k/gen/frexp.c
deleted file mode 100644
index a3f0f7e4c8a..00000000000
--- a/lib/libc/arch/m88k/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.4 2003/06/02 20:18:31 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.4 2003/06/02 20:18:31 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/mips64/gen/Makefile.inc b/lib/libc/arch/mips64/gen/Makefile.inc
index b9d62dd689b..5d42987bade 100644
--- a/lib/libc/arch/mips64/gen/Makefile.inc
+++ b/lib/libc/arch/mips64/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.1 2004/08/11 17:30:59 pefo Exp $
+# $OpenBSD: Makefile.inc,v 1.2 2005/02/01 15:12:30 millert Exp $
-SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.S ldexp.S modf.S
+SRCS+= _setjmp.S fabs.S infinity.c isinf.S ldexp.S modf.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= setjmp.S sigsetjmp.S
diff --git a/lib/libc/arch/mips64/gen/frexp.c b/lib/libc/arch/mips64/gen/frexp.c
deleted file mode 100644
index 5c285637d12..00000000000
--- a/lib/libc/arch/mips64/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.1 2004/08/11 17:30:59 pefo 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2004/08/11 17:30:59 pefo Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/powerpc/gen/Makefile.inc b/lib/libc/arch/powerpc/gen/Makefile.inc
index 7f9092c3dc4..fd29d2f7334 100644
--- a/lib/libc/arch/powerpc/gen/Makefile.inc
+++ b/lib/libc/arch/powerpc/gen/Makefile.inc
@@ -1,5 +1,5 @@
SRCS+= isinf.c isnan.c infinity.c setjmp.S sigsetjmp.S flt_rounds.c modf.c
-SRCS+= ldexp.c fabs.c frexp.c
+SRCS+= ldexp.c fabs.c
SRCS+= fpgetmask.c fpsetmask.c
SRCS+= fpgetround.c fpsetround.c
SRCS+= fpgetsticky.c fpsetsticky.c
diff --git a/lib/libc/arch/powerpc/gen/frexp.c b/lib/libc/arch/powerpc/gen/frexp.c
deleted file mode 100644
index a5afb1a6d24..00000000000
--- a/lib/libc/arch/powerpc/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:32 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:32 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/sparc/gen/Makefile.inc b/lib/libc/arch/sparc/gen/Makefile.inc
index 95e1b4011ef..c8d4731116f 100644
--- a/lib/libc/arch/sparc/gen/Makefile.inc
+++ b/lib/libc/arch/sparc/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.3 2003/05/02 19:20:26 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2005/02/01 15:12:30 millert Exp $
-SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
+SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
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
diff --git a/lib/libc/arch/sparc/gen/frexp.c b/lib/libc/arch/sparc/gen/frexp.c
deleted file mode 100644
index a5afb1a6d24..00000000000
--- a/lib/libc/arch/sparc/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:32 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.5 2003/06/02 20:18:32 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/sparc64/gen/Makefile.inc b/lib/libc/arch/sparc64/gen/Makefile.inc
index 227469f6920..11971c740bd 100644
--- a/lib/libc/arch/sparc64/gen/Makefile.inc
+++ b/lib/libc/arch/sparc64/gen/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.2 2003/05/02 19:20:26 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2005/02/01 15:12:30 millert Exp $
-SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
+SRCS+= _setjmp.S fabs.S infinity.c isinf.c isnan.c ldexp.c modf.S
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
diff --git a/lib/libc/arch/sparc64/gen/frexp.c b/lib/libc/arch/sparc64/gen/frexp.c
deleted file mode 100644
index 727ab55eb6e..00000000000
--- a/lib/libc/arch/sparc64/gen/frexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: frexp.c,v 1.3 2003/06/02 20:18:32 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.3 2003/06/02 20:18:32 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/ieee.h>
-
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct ieee_double s;
- } u;
-
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
- u.s.dbl_exp = DBL_EXP_BIAS - 1;
- }
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
- }
-}
diff --git a/lib/libc/arch/vax/gen/Makefile.inc b/lib/libc/arch/vax/gen/Makefile.inc
index a8e3f950733..5385ac93d4a 100644
--- a/lib/libc/arch/vax/gen/Makefile.inc
+++ b/lib/libc/arch/vax/gen/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.3 1996/08/19 08:18:20 tholo Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2005/02/01 15:12:30 millert Exp $
-SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c ldexp.S \
+SRCS+= _setjmp.S fabs.S infinity.c isinf.c ldexp.S \
modf.S setjmp.S udiv.S urem.S alloca.S sigsetjmp.S
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 7e37e95c210..91c6a6e4468 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.36 2004/02/01 17:53:59 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.37 2005/02/01 15:12:28 millert Exp $
# gen sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/gen ${LIBCSRCDIR}/gen
@@ -6,7 +6,7 @@
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 fstab.c ftok.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 \
diff --git a/lib/libc/arch/i386/gen/frexp.c b/lib/libc/gen/frexp.c
index 98b671a67ca..95c73a32d07 100644
--- a/lib/libc/arch/i386/gen/frexp.c
+++ b/lib/libc/gen/frexp.c
@@ -1,12 +1,8 @@
-/* $OpenBSD: frexp.c,v 1.6 2003/06/25 21:15:04 deraadt Exp $ */
+/* $OpenBSD: frexp.c,v 1.1 2005/02/01 15:12:28 millert 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.
+/*-
+ * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -16,14 +12,11 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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)
@@ -31,45 +24,47 @@
* 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.
+ *
+ * $FreeBSD: frexp.c,v 1.1 2004/07/18 21:23:39 das Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: frexp.c,v 1.6 2003/06/25 21:15:04 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2005/02/01 15:12:28 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
-/*
- * Split the given value into a fraction in the range [0.5, 1.0) and
- * an exponent, such that frac * (2^exp) == value. If value is 0,
- * return 0.
- */
double
-frexp(value, eptr)
- double value;
- int *eptr;
+frexp(double v, int *ex)
{
- union {
+ union {
double v;
struct ieee_double s;
} u;
- if (value) {
- /*
- * Fractions in [0.5..1.0) have an exponent of 2^-1.
- * Leave Inf and NaN alone, however.
- * WHAT ABOUT DENORMS?
- */
- u.v = value;
- if (u.s.dbl_exp != DBL_EXP_INFNAN) {
- *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
+ u.v = v;
+ switch (u.s.dbl_exp) {
+ case 0: /* 0 or subnormal */
+ if ((u.s.dbl_fracl | u.s.dbl_frach) == 0) {
+ *ex = 0;
+ } else {
+ /*
+ * The power of 2 is arbitrary, any value from 54 to
+ * 1024 will do.
+ */
+ u.v *= 0x1.0p514;
+ *ex = u.s.dbl_exp - (DBL_EXP_BIAS - 1 + 514);
u.s.dbl_exp = DBL_EXP_BIAS - 1;
}
- return (u.v);
- } else {
- *eptr = 0;
- return ((double)0);
+ break;
+ case DBL_EXP_INFNAN: /* Inf or NaN; value of *ex is unspecified */
+ break;
+ default: /* normal */
+ *ex = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
+ u.s.dbl_exp = DBL_EXP_BIAS - 1;
+ break;
}
+ return (u.v);
}