public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int.
@ 2018-09-03 7:42 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2018-09-03 7:42 UTC (permalink / raw)
To: newlib-cvs
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
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-03 7:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 7:42 [newlib-cygwin] e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int Corinna Vinschen
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).