public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] libm: switch sf_log1p from double error routines to float
Date: Mon, 02 Dec 2019 09:05:00 -0000	[thread overview]
Message-ID: <20191202090512.7658.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7a526cdc28a3c4acce98e8a99b06562452c90d07

commit 7a526cdc28a3c4acce98e8a99b06562452c90d07
Author: Keith Packard <keithp@keithp.com>
Date:   Fri Nov 29 11:23:20 2019 -0800

    libm: switch sf_log1p from double error routines to float
    
    sf_log1p was using __math_divzero and __math_invalid, which
    drag in a pile of double-precision code. Switch to using the
    single-precision variants. This also required making those
    available in __OBSOLETE_MATH mode.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

Diff:
---
 newlib/libm/common/math_errf.c | 2 --
 newlib/libm/common/sf_log1p.c  | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/newlib/libm/common/math_errf.c b/newlib/libm/common/math_errf.c
index 762fc27..53c68b1 100644
--- a/newlib/libm/common/math_errf.c
+++ b/newlib/libm/common/math_errf.c
@@ -75,7 +75,6 @@ __math_oflowf (uint32_t sign)
   return xflowf (sign, 0x1p97f);
 }
 
-#if !__OBSOLETE_MATH
 HIDDEN float
 __math_divzerof (uint32_t sign)
 {
@@ -89,4 +88,3 @@ __math_invalidf (float x)
   float y = (x - x) / (x - x);
   return isnan (x) ? y : with_errnof (y, EDOM);
 }
-#endif /* !__OBSOLETE_MATH */
diff --git a/newlib/libm/common/sf_log1p.c b/newlib/libm/common/sf_log1p.c
index d867680..d326e00 100644
--- a/newlib/libm/common/sf_log1p.c
+++ b/newlib/libm/common/sf_log1p.c
@@ -56,9 +56,9 @@ static float zero = 0.0;
 	if (hx < 0x3ed413d7) {			/* x < 0.41422  */
 	    if(ax>=0x3f800000) {		/* x <= -1.0 */
 		if(x==(float)-1.0)
-		    return __math_divzero (1); /* log1p(-1)=-inf */
+		    return __math_divzerof (1); /* log1p(-1)=-inf */
 		else
-		    return __math_invalid (x);	/* log1p(x<-1)=NaN */
+		    return __math_invalidf (x);	/* log1p(x<-1)=NaN */
 	    }
 	    if(ax<0x31000000) {			/* |x| < 2**-29 */
 		if(two25+x>zero			/* raise inexact */


                 reply	other threads:[~2019-12-02  9:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191202090512.7658.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@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).