public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [libgfortran,committed] Fix fallback scalbn
@ 2007-09-21 12:05 François-Xavier Coudert
  0 siblings, 0 replies; only message in thread
From: François-Xavier Coudert @ 2007-09-21 12:05 UTC (permalink / raw)
  To: fortran, gcc-patches

The patch below was committed as rev. 128648. It fixes PR26253
(fallback scalbn doesn't handle denormals) by simply calling ldexp()
when floating-point radix is 2.

Tested on x86_64-linux by faking a system without scalbn().

FX




Index: ChangeLog
===================================================================
--- ChangeLog   (revision 128647)
+++ ChangeLog   (working copy)
@@ -1,5 +1,10 @@
 2007-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

+       PR libfortran/26253
+       * intrinsics/c99_functions.c (scalbn): Use ldexp if appopriate.
+
+2007-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
        PR libfortran/23272
        * io/unix.c (id_from_handle, id_from_path, id_from_fd): New
        functions.
Index: intrinsics/c99_functions.c
===================================================================
--- intrinsics/c99_functions.c  (revision 128647)
+++ intrinsics/c99_functions.c  (working copy)
@@ -341,7 +341,11 @@ log10f(float x)
 double
 scalbn(double x, int y)
 {
+#if (FLT_RADIX == 2) && defined(HAVE_LDEXP)
+  return ldexp (x, y);
+#else
   return x * pow(FLT_RADIX, y);
+#endif
 }
 #endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-21 10:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-21 12:05 [libgfortran,committed] Fix fallback scalbn François-Xavier Coudert

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).