From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129220 invoked by alias); 3 Sep 2018 07:42:44 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 129203 invoked by uid 9078); 3 Sep 2018 07:42:44 -0000 Date: Mon, 03 Sep 2018 07:42:00 -0000 Message-ID: <20180903074244.129201.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen 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. X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Beniston X-Git-Refname: refs/heads/master X-Git-Oldrev: 3017f23f1cfdf31dbebdeaa32e45aca15c0b77b6 X-Git-Newrev: fcc1e7039f92509ccca895432844dc26a2366671 X-SW-Source: 2018-q3/txt/msg00110.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fcc1e7039f92509ccca895432844dc26a2366671 commit fcc1e7039f92509ccca895432844dc26a2366671 Author: Jon Beniston 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 }