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] e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int.
Date: Mon, 03 Sep 2018 07:42:00 -0000	[thread overview]
Message-ID: <20180903074244.129201.qmail@sourceware.org> (raw)

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

commit fcc1e7039f92509ccca895432844dc26a2366671
Author: Jon Beniston <jon@beniston.com>
Date:   Fri Aug 31 22:42:29 2018 +0100

    e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int.

Diff:
---
 newlib/libm/math/e_scalb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libm/math/e_scalb.c b/newlib/libm/math/e_scalb.c
index 0bb924b..4d8bb8b 100644
--- a/newlib/libm/math/e_scalb.c
+++ b/newlib/libm/math/e_scalb.c
@@ -46,8 +46,13 @@
 	    else       return x/(-fn);
 	}
 	if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
+#if INT_MAX == 32767
+	if ( fn > 65000.0) return scalbln(x, 65000);
+	if (-fn > 65000.0) return scalbln(x,-65000);
+#else
 	if ( fn > 65000.0) return scalbn(x, 65000);
 	if (-fn > 65000.0) return scalbn(x,-65000);
+#endif
 	return scalbn(x,(int)fn);
 #endif
 }


                 reply	other threads:[~2018-09-03  7:42 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=20180903074244.129201.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).