From: Joel Sherrill <joel@rtems.org>
To: newlib@sourceware.org
Subject: [PATCH newlib v1 3/4] Split libm/common/frexpl.c into LDBL_EQ_DBL and long double versions
Date: Mon, 22 Aug 2022 17:50:21 -0500 [thread overview]
Message-ID: <20220822225022.32209-4-joel@rtems.org> (raw)
In-Reply-To: <20220822225022.32209-1-joel@rtems.org>
This resulted in the contents of libm/common/frexpl.c being split
into libm/common/ldbl/s_frexpl.c and libm/common/ldbl_eq_dbl/s_frexpl.c.
---
newlib/Makefile.am | 2 +-
newlib/libm/common/Makefile.inc | 6 +--
.../libm/common/{frexpl.c => ldbl/s_frexpl.c} | 9 ----
newlib/libm/common/ldbl_eq_dbl/s_frexpl.c | 42 +++++++++++++++++++
4 files changed, 46 insertions(+), 13 deletions(-)
rename newlib/libm/common/{frexpl.c => ldbl/s_frexpl.c} (94%)
create mode 100644 newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 0108d8576..bd99c7b4f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -116,7 +116,7 @@ MATHOBJS_IN_LIBC = \
libm_a-s_isnand.o libm_a-sf_isnanf.o \
libm_a-s_nan.o libm_a-sf_nan.o \
libm_a-s_ldexp.o libm_a-sf_ldexp.o \
- libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
+ libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-s_frexpl.o \
libm_a-s_modf.o \
libm_a-sf_modf.o libm_a-s_scalbn.o \
libm_a-sf_scalbn.o \
diff --git a/newlib/libm/common/Makefile.inc b/newlib/libm/common/Makefile.inc
index d08b8b21a..9ff1231e9 100644
--- a/newlib/libm/common/Makefile.inc
+++ b/newlib/libm/common/Makefile.inc
@@ -60,7 +60,7 @@
%D%/sinf.c %D%/cosf.c %D%/sincosf.c %D%/sincosf_data.c %D%/math_errf.c
%C%_lsrc = \
- %D%/atanl.c %D%/cosl.c %D%/sinl.c %D%/tanl.c %D%/tanhl.c %D%/frexpl.c %D%/modfl.c %D%/ceill.c %D%/fabsl.c \
+ %D%/atanl.c %D%/cosl.c %D%/sinl.c %D%/tanl.c %D%/tanhl.c %D%/modfl.c %D%/ceill.c %D%/fabsl.c \
%D%/floorl.c %D%/log1pl.c %D%/expm1l.c %D%/acosl.c %D%/asinl.c %D%/atan2l.c %D%/coshl.c %D%/sinhl.c \
%D%/expl.c %D%/ldexpl.c %D%/logl.c %D%/log10l.c %D%/powl.c %D%/sqrtl.c %D%/fmodl.c %D%/hypotl.c \
%D%/copysignl.c %D%/nanl.c %D%/ilogbl.c %D%/asinhl.c %D%/cbrtl.c %D%/nextafterl.c %D%/rintl.c \
@@ -70,9 +70,9 @@
%D%/logbl.c %D%/nexttowardf.c %D%/nexttoward.c %D%/nexttowardl.c %D%/log2l.c \
%D%/sl_finite.c
-%C%_ldbl_eq_dbl_src = %D%/ldbl_eq_dbl/s_truncl.c
+%C%_ldbl_eq_dbl_src = %D%/ldbl_eq_dbl/s_frexpl.c %D%/ldbl_eq_dbl/s_truncl.c
-%C%_ldbl_src = %D%/ldbl/s_truncl.c
+%C%_ldbl_src = %D%/ldbl/s_frexpl.c %D%/ldbl/s_truncl.c
libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
diff --git a/newlib/libm/common/frexpl.c b/newlib/libm/common/ldbl/s_frexpl.c
similarity index 94%
rename from newlib/libm/common/frexpl.c
rename to newlib/libm/common/ldbl/s_frexpl.c
index 8da2823ca..63835c105 100644
--- a/newlib/libm/common/frexpl.c
+++ b/newlib/libm/common/ldbl/s_frexpl.c
@@ -32,14 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <float.h>
#include "local.h"
-/* On platforms where long double is as wide as double. */
-#if defined(_LDBL_EQ_DBL)
-long double
-frexpl (long double x, int *eptr)
-{
- return frexp(x, eptr);
-}
-#else /* !_DBL_EQ_DBL */
# if (LDBL_MANT_DIG == 53) /* 64-bit long double */
static const double scale = 0x1p54;
@@ -149,4 +141,3 @@ frexpl (long double x, int *eptr)
u.u32.exp = LDBL_MAX_EXP - 2; /* -1 */
return u.x;
}
-#endif /* !_LDBL_EQ_DBL */
diff --git a/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c b/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
new file mode 100644
index 000000000..90ae0153f
--- /dev/null
+++ b/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
@@ -0,0 +1,42 @@
+/*
+(C) Copyright IBM Corp. 2009
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* 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.
+* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 <math.h>
+#include <float.h>
+#include "local.h"
+
+/* On platforms where long double is as wide as double. */
+#if defined(_LDBL_EQ_DBL)
+long double
+frexpl (long double x, int *eptr)
+{
+ return frexp(x, eptr);
+}
+#endif /* !_LDBL_EQ_DBL */
--
2.24.4
next prev parent reply other threads:[~2022-08-22 22:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 22:50 [PATCH newlib v1 0/4] Add FreeBSD long double functions Joel Sherrill
2022-08-22 22:50 ` [PATCH newlib v1 1/4] Add infrastructure for incorporating FreeBSD long double methods Joel Sherrill
2022-08-22 22:50 ` [PATCH newlib v1 2/4] Makefile.in and configure: Regenerated Joel Sherrill
2022-08-22 22:50 ` Joel Sherrill [this message]
2022-08-22 22:50 ` [PATCH newlib v1 4/4] Makefile.in: Regenerated Joel Sherrill
2022-08-24 9:26 ` [PATCH newlib v1 0/4] Add FreeBSD long double functions Corinna Vinschen
2022-08-24 13:40 ` Joel Sherrill
2022-08-24 13:40 ` Joel Sherrill
2022-08-26 15:05 ` Corinna Vinschen
2022-08-26 15:45 ` Joel Sherrill
2022-08-26 15:45 ` Joel Sherrill
2022-08-26 17:45 ` Corinna Vinschen
2022-08-26 20:45 ` Jeff Johnston
2022-08-26 20:45 ` Jeff Johnston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220822225022.32209-4-joel@rtems.org \
--to=joel@rtems.org \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).