]> gcc.gnu.org Git - gcc.git/commitdiff
mtype.m4 (upcase, [...]): New macros.
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 28 Aug 2010 22:10:52 +0000 (22:10 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 28 Aug 2010 22:10:52 +0000 (22:10 +0000)
* m4/mtype.m4 (upcase, hasmathfunc, mathfunc_macro): New macros.
* m4/fraction.m4: Use new macros to support quad-float types.
* m4/set_exponent.m4: Likewise.
* m4/spacing.m4: Likewise.
* m4/exponent.m4: Likewise.
* m4/nearest.m4: Likewise.
* m4/norm2.m4: Likewise.
* m4/bessel.m4: Likewise.
* m4/rrspacing.m4: Likewise.
* generated/bessel_r4.c:Regenerated.
* generated/bessel_r8.c: Regenerated.
* generated/bessel_r10.c: Regenerated.
* generated/bessel_r16.c: Regenerated.
* generated/exponent_r4.c: Regenerated.
* generated/exponent_r8.c: Regenerated.
* generated/exponent_r10.c: Regenerated.
* generated/exponent_r16.c: Regenerated.
* generated/fraction_r4.c: Regenerated.
* generated/fraction_r8.c: Regenerated.
* generated/fraction_r10.c: Regenerated.
* generated/fraction_r16.c: Regenerated.
* generated/nearest_r4.c: Regenerated.
* generated/nearest_r8.c: Regenerated.
* generated/nearest_r10.c: Regenerated.
* generated/nearest_r16.c: Regenerated.
* generated/norm2_r4.c: Regenerated.
* generated/norm2_r8.c: Regenerated.
* generated/norm2_r10.c: Regenerated.
* generated/norm2_r16.c: Regenerated.
* generated/rrspacing_r4.c: Regenerated.
* generated/rrspacing_r8.c: Regenerated.
* generated/rrspacing_r10.c: Regenerated.
* generated/rrspacing_r16.c: Regenerated.
* generated/set_exponent_r4.c: Regenerated.
* generated/set_exponent_r8.c: Regenerated.
* generated/set_exponent_r10.c: Regenerated.
* generated/set_exponent_r16.c: Regenerated.
* generated/spacing_r4.c: Regenerated.
* generated/spacing_r8.c: Regenerated.
* generated/spacing_r10.c: Regenerated.
* generated/spacing_r16.c: Regenerated.

From-SVN: r163620

42 files changed:
libgfortran/ChangeLog
libgfortran/generated/bessel_r10.c
libgfortran/generated/bessel_r16.c
libgfortran/generated/bessel_r4.c
libgfortran/generated/bessel_r8.c
libgfortran/generated/exponent_r10.c
libgfortran/generated/exponent_r16.c
libgfortran/generated/exponent_r4.c
libgfortran/generated/exponent_r8.c
libgfortran/generated/fraction_r10.c
libgfortran/generated/fraction_r16.c
libgfortran/generated/fraction_r4.c
libgfortran/generated/fraction_r8.c
libgfortran/generated/nearest_r10.c
libgfortran/generated/nearest_r16.c
libgfortran/generated/nearest_r4.c
libgfortran/generated/nearest_r8.c
libgfortran/generated/norm2_r10.c
libgfortran/generated/norm2_r16.c
libgfortran/generated/norm2_r4.c
libgfortran/generated/norm2_r8.c
libgfortran/generated/rrspacing_r10.c
libgfortran/generated/rrspacing_r16.c
libgfortran/generated/rrspacing_r4.c
libgfortran/generated/rrspacing_r8.c
libgfortran/generated/set_exponent_r10.c
libgfortran/generated/set_exponent_r16.c
libgfortran/generated/set_exponent_r4.c
libgfortran/generated/set_exponent_r8.c
libgfortran/generated/spacing_r10.c
libgfortran/generated/spacing_r16.c
libgfortran/generated/spacing_r4.c
libgfortran/generated/spacing_r8.c
libgfortran/m4/bessel.m4
libgfortran/m4/exponent.m4
libgfortran/m4/fraction.m4
libgfortran/m4/mtype.m4
libgfortran/m4/nearest.m4
libgfortran/m4/norm2.m4
libgfortran/m4/rrspacing.m4
libgfortran/m4/set_exponent.m4
libgfortran/m4/spacing.m4

index 0c31d7287151bfee67ef43a2d1cfd6b7a63d0dd4..b6fa20f8b77a459f593d1fada5476064d52abbc1 100644 (file)
@@ -1,3 +1,47 @@
+2010-08-29  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       * m4/mtype.m4 (upcase, hasmathfunc, mathfunc_macro): New macros.
+       * m4/fraction.m4: Use new macros to support quad-float types.
+       * m4/set_exponent.m4: Likewise.
+       * m4/spacing.m4: Likewise.
+       * m4/exponent.m4: Likewise.
+       * m4/nearest.m4: Likewise.
+       * m4/norm2.m4: Likewise.
+       * m4/bessel.m4: Likewise.
+       * m4/rrspacing.m4: Likewise.
+       * generated/bessel_r4.c:Regenerated.
+       * generated/bessel_r8.c: Regenerated.
+       * generated/bessel_r10.c: Regenerated.
+       * generated/bessel_r16.c: Regenerated.
+       * generated/exponent_r4.c: Regenerated.
+       * generated/exponent_r8.c: Regenerated.
+       * generated/exponent_r10.c: Regenerated.
+       * generated/exponent_r16.c: Regenerated.
+       * generated/fraction_r4.c: Regenerated.
+       * generated/fraction_r8.c: Regenerated.
+       * generated/fraction_r10.c: Regenerated.
+       * generated/fraction_r16.c: Regenerated.
+       * generated/nearest_r4.c: Regenerated.
+       * generated/nearest_r8.c: Regenerated.
+       * generated/nearest_r10.c: Regenerated.
+       * generated/nearest_r16.c: Regenerated.
+       * generated/norm2_r4.c: Regenerated.
+       * generated/norm2_r8.c: Regenerated.
+       * generated/norm2_r10.c: Regenerated.
+       * generated/norm2_r16.c: Regenerated.
+       * generated/rrspacing_r4.c: Regenerated.
+       * generated/rrspacing_r8.c: Regenerated.
+       * generated/rrspacing_r10.c: Regenerated.
+       * generated/rrspacing_r16.c: Regenerated.
+       * generated/set_exponent_r4.c: Regenerated.
+       * generated/set_exponent_r8.c: Regenerated.
+       * generated/set_exponent_r10.c: Regenerated.
+       * generated/set_exponent_r16.c: Regenerated.
+       * generated/spacing_r4.c: Regenerated.
+       * generated/spacing_r8.c: Regenerated.
+       * generated/spacing_r10.c: Regenerated.
+       * generated/spacing_r16.c: Regenerated.
+
 2010-08-28  Tobias Burnus  <burnus@net-b.de>
 
        * mk-kinds-h.sh: Disable REAL(16) if REAL(10) is available.
index 579de8445b0d6c469b6bfe21ed91b69daa6099ee..efef450518851f078a8fcb2ae653925f64d170f5 100644 (file)
@@ -29,6 +29,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10)
 
 
@@ -67,28 +70,28 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0L))
+  if (unlikely (x == 0))
     {
-      ret->data[0] = 1.0L;
+      ret->data[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0.0L;
+        ret->data[i*stride] = 0;
       return;
     }
 
   ret->data = ret->data;
-  last1 = jnl (n2, x);
+  last1 = MATHFUNC(jn) (n2, x);
   ret->data[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = jnl (n2 - 1, x);
+  last2 = MATHFUNC(jn) (n2 - 1, x);
   ret->data[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0L/x;
+  x2rev = GFC_REAL_10_LITERAL(2.)/x;
 
   for (i = n2-n1-2; i >= 0; i--)
     {
@@ -135,7 +138,7 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0L))
+  if (unlikely (x == 0))
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined(GFC_REAL_10_INFINITY)
@@ -147,19 +150,19 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2,
     }
 
   ret->data = ret->data;
-  last1 = ynl (n1, x);
+  last1 = MATHFUNC(yn) (n1, x);
   ret->data[0] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = ynl (n1 + 1, x);
+  last2 = MATHFUNC(yn) (n1 + 1, x);
   ret->data[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0L/x;
+  x2rev = GFC_REAL_10_LITERAL(2.)/x;
 
   for (i = 2; i <= n1+n2; i++)
     {
index a3ef181012e1c89a9027aa19957a1f35cffd343d..d5ca883e8990172e899cf58d46f18a4eab4a938d 100644 (file)
@@ -29,11 +29,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
 #if defined (HAVE_GFC_REAL_16)
 
 
 
-#if defined (HAVE_JNL)
+#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_JNL))
 extern void bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1,
                                     int n2, GFC_REAL_16 x);
 export_proto(bessel_jn_r16);
@@ -67,28 +74,28 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0L))
+  if (unlikely (x == 0))
     {
-      ret->data[0] = 1.0L;
+      ret->data[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0.0L;
+        ret->data[i*stride] = 0;
       return;
     }
 
   ret->data = ret->data;
-  last1 = jnl (n2, x);
+  last1 = MATHFUNC(jn) (n2, x);
   ret->data[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = jnl (n2 - 1, x);
+  last2 = MATHFUNC(jn) (n2 - 1, x);
   ret->data[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0L/x;
+  x2rev = GFC_REAL_16_LITERAL(2.)/x;
 
   for (i = n2-n1-2; i >= 0; i--)
     {
@@ -100,7 +107,7 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x
 
 #endif
 
-#if defined (HAVE_YNL)
+#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_YNL))
 extern void bessel_yn_r16 (gfc_array_r16 * const restrict ret,
                                     int n1, int n2, GFC_REAL_16 x);
 export_proto(bessel_yn_r16);
@@ -135,7 +142,7 @@ bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0L))
+  if (unlikely (x == 0))
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined(GFC_REAL_16_INFINITY)
@@ -147,19 +154,19 @@ bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2,
     }
 
   ret->data = ret->data;
-  last1 = ynl (n1, x);
+  last1 = MATHFUNC(yn) (n1, x);
   ret->data[0] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = ynl (n1 + 1, x);
+  last2 = MATHFUNC(yn) (n1 + 1, x);
   ret->data[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0L/x;
+  x2rev = GFC_REAL_16_LITERAL(2.)/x;
 
   for (i = 2; i <= n1+n2; i++)
     {
index 961c67cb5649a4643476a9bfc57c56389a092e5c..794a5f6b7f9e8a8ca351836da3b83b0bcdb1f6b5 100644 (file)
@@ -29,6 +29,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4)
 
 
@@ -67,28 +70,28 @@ bessel_jn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2, GFC_REAL_4 x)
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0F))
+  if (unlikely (x == 0))
     {
-      ret->data[0] = 1.0F;
+      ret->data[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0.0F;
+        ret->data[i*stride] = 0;
       return;
     }
 
   ret->data = ret->data;
-  last1 = jnf (n2, x);
+  last1 = MATHFUNC(jn) (n2, x);
   ret->data[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = jnf (n2 - 1, x);
+  last2 = MATHFUNC(jn) (n2 - 1, x);
   ret->data[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0F/x;
+  x2rev = GFC_REAL_4_LITERAL(2.)/x;
 
   for (i = n2-n1-2; i >= 0; i--)
     {
@@ -135,7 +138,7 @@ bessel_yn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0F))
+  if (unlikely (x == 0))
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined(GFC_REAL_4_INFINITY)
@@ -147,19 +150,19 @@ bessel_yn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2,
     }
 
   ret->data = ret->data;
-  last1 = ynf (n1, x);
+  last1 = MATHFUNC(yn) (n1, x);
   ret->data[0] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = ynf (n1 + 1, x);
+  last2 = MATHFUNC(yn) (n1 + 1, x);
   ret->data[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0F/x;
+  x2rev = GFC_REAL_4_LITERAL(2.)/x;
 
   for (i = 2; i <= n1+n2; i++)
     {
index c896ae41a91d63d6d44afeeacbc29d050cbfc55b..e9f84b4ce546710f56ec11c30d7c958c59ac52a3 100644 (file)
@@ -29,6 +29,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8)
 
 
@@ -67,28 +70,28 @@ bessel_jn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2, GFC_REAL_8 x)
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0))
+  if (unlikely (x == 0))
     {
-      ret->data[0] = 1.0;
+      ret->data[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0.0;
+        ret->data[i*stride] = 0;
       return;
     }
 
   ret->data = ret->data;
-  last1 = jn (n2, x);
+  last1 = MATHFUNC(jn) (n2, x);
   ret->data[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = jn (n2 - 1, x);
+  last2 = MATHFUNC(jn) (n2 - 1, x);
   ret->data[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0/x;
+  x2rev = GFC_REAL_8_LITERAL(2.)/x;
 
   for (i = n2-n1-2; i >= 0; i--)
     {
@@ -135,7 +138,7 @@ bessel_yn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0))
+  if (unlikely (x == 0))
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined(GFC_REAL_8_INFINITY)
@@ -147,19 +150,19 @@ bessel_yn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2,
     }
 
   ret->data = ret->data;
-  last1 = yn (n1, x);
+  last1 = MATHFUNC(yn) (n1, x);
   ret->data[0] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = yn (n1 + 1, x);
+  last2 = MATHFUNC(yn) (n1 + 1, x);
   ret->data[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0/x;
+  x2rev = GFC_REAL_8_LITERAL(2.)/x;
 
   for (i = 2; i <= n1+n2; i++)
     {
index 1b56765b3b16d6bf58b225bd5e46fb4a1b65380d..ceafda30e2c132c3e886ab0c38d023199f949b3f 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
 
 extern GFC_INTEGER_4 exponent_r10 (GFC_REAL_10 s);
@@ -35,7 +38,7 @@ GFC_INTEGER_4
 exponent_r10 (GFC_REAL_10 s)
 {
   int ret;
-  frexpl (s, &ret);
+  MATHFUNC(frexp) (s, &ret);
   return ret;
 }
 
index 23f04152ddb01fff12e882a16cb6cc5a5d780bf1..899a2aef35919fd0c45bb1304cdafd2db64ee312 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
 
 extern GFC_INTEGER_4 exponent_r16 (GFC_REAL_16 s);
 export_proto(exponent_r16);
@@ -35,7 +42,7 @@ GFC_INTEGER_4
 exponent_r16 (GFC_REAL_16 s)
 {
   int ret;
-  frexpl (s, &ret);
+  MATHFUNC(frexp) (s, &ret);
   return ret;
 }
 
index b2df840a48d5626b94d8f07df4ed2e388d0fe679..04aee1c922c991a3c4497c0c83ae2283457dd852 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
 
 extern GFC_INTEGER_4 exponent_r4 (GFC_REAL_4 s);
@@ -35,7 +38,7 @@ GFC_INTEGER_4
 exponent_r4 (GFC_REAL_4 s)
 {
   int ret;
-  frexpf (s, &ret);
+  MATHFUNC(frexp) (s, &ret);
   return ret;
 }
 
index ed4319ffa078076bec165a01c141e5914ff4286e..5c35c5d0de90695697f788800221ad869c7d08ea 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
 
 extern GFC_INTEGER_4 exponent_r8 (GFC_REAL_8 s);
@@ -35,7 +38,7 @@ GFC_INTEGER_4
 exponent_r8 (GFC_REAL_8 s)
 {
   int ret;
-  frexp (s, &ret);
+  MATHFUNC(frexp) (s, &ret);
   return ret;
 }
 
index 46aa65d2ceeaef861bc1ad1197524239d6e92be6..38cbdf8b44db6e855f88116ca90e4da74a8626a4 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 fraction_r10 (GFC_REAL_10 s);
@@ -35,7 +38,7 @@ GFC_REAL_10
 fraction_r10 (GFC_REAL_10 s)
 {
   int dummy_exp;
-  return frexpl (s, &dummy_exp);
+  return MATHFUNC(frexp) (s, &dummy_exp);
 }
 
 #endif
index 1ae3262a43aec34c14180625b822c4a73c013849..97e283dddc8e5d4169105b69c254caf5f4278e9e 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
 
 extern GFC_REAL_16 fraction_r16 (GFC_REAL_16 s);
 export_proto(fraction_r16);
@@ -35,7 +42,7 @@ GFC_REAL_16
 fraction_r16 (GFC_REAL_16 s)
 {
   int dummy_exp;
-  return frexpl (s, &dummy_exp);
+  return MATHFUNC(frexp) (s, &dummy_exp);
 }
 
 #endif
index f2ea9e27918ae140a35b3beba00727833e4e66ff..a42e1468f516d34b47757218aec5586de44b65d7 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 fraction_r4 (GFC_REAL_4 s);
@@ -35,7 +38,7 @@ GFC_REAL_4
 fraction_r4 (GFC_REAL_4 s)
 {
   int dummy_exp;
-  return frexpf (s, &dummy_exp);
+  return MATHFUNC(frexp) (s, &dummy_exp);
 }
 
 #endif
index 1e0f9361add858c2ef85140b5e1eb5210f1ec7a5..1e267091f376dcfc2ba6075c2c9529d23eb82d66 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 fraction_r8 (GFC_REAL_8 s);
@@ -35,7 +38,7 @@ GFC_REAL_8
 fraction_r8 (GFC_REAL_8 s)
 {
   int dummy_exp;
-  return frexp (s, &dummy_exp);
+  return MATHFUNC(frexp) (s, &dummy_exp);
 }
 
 #endif
index 9601e32332cc87dad8ef34a16a9b1cf47d0aa111..eb7a3b15a0de8132ca4a1b08bd7d28fac176a8ca 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_COPYSIGNL) && defined (HAVE_NEXTAFTERL)
 
 extern GFC_REAL_10 nearest_r10 (GFC_REAL_10 s, GFC_REAL_10 dir);
@@ -34,15 +37,15 @@ export_proto(nearest_r10);
 GFC_REAL_10
 nearest_r10 (GFC_REAL_10 s, GFC_REAL_10 dir)
 {
-  dir = copysignl (__builtin_infl (), dir);
+  dir = MATHFUNC(copysign) (MATHFUNC(__builtin_inf) (), dir);
   if (FLT_EVAL_METHOD != 0)
     {
       /* ??? Work around glibc bug on x86.  */
-      volatile GFC_REAL_10 r = nextafterl (s, dir);
+      volatile GFC_REAL_10 r = MATHFUNC(nextafter) (s, dir);
       return r;
     }
   else
-    return nextafterl (s, dir);
+    return MATHFUNC(nextafter) (s, dir);
 }
 
 #endif
index 85499cbad14745eae2eb06b257c4a3b8710f0e39..474cf3609aecbd2ed94951db196434bbf9dfdf43 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_COPYSIGNL) && defined (HAVE_NEXTAFTERL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_COPYSIGNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_NEXTAFTERL))
 
 extern GFC_REAL_16 nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir);
 export_proto(nearest_r16);
@@ -34,15 +41,15 @@ export_proto(nearest_r16);
 GFC_REAL_16
 nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir)
 {
-  dir = copysignl (__builtin_infl (), dir);
+  dir = MATHFUNC(copysign) (MATHFUNC(__builtin_inf) (), dir);
   if (FLT_EVAL_METHOD != 0)
     {
       /* ??? Work around glibc bug on x86.  */
-      volatile GFC_REAL_16 r = nextafterl (s, dir);
+      volatile GFC_REAL_16 r = MATHFUNC(nextafter) (s, dir);
       return r;
     }
   else
-    return nextafterl (s, dir);
+    return MATHFUNC(nextafter) (s, dir);
 }
 
 #endif
index 8ef4f31640054c833e33b98b58cd67970efed3a2..076df4b33e83c5ac3126c1a7b78cfa388170a824 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_COPYSIGNF) && defined (HAVE_NEXTAFTERF)
 
 extern GFC_REAL_4 nearest_r4 (GFC_REAL_4 s, GFC_REAL_4 dir);
@@ -34,15 +37,15 @@ export_proto(nearest_r4);
 GFC_REAL_4
 nearest_r4 (GFC_REAL_4 s, GFC_REAL_4 dir)
 {
-  dir = copysignf (__builtin_inff (), dir);
+  dir = MATHFUNC(copysign) (MATHFUNC(__builtin_inf) (), dir);
   if (FLT_EVAL_METHOD != 0)
     {
       /* ??? Work around glibc bug on x86.  */
-      volatile GFC_REAL_4 r = nextafterf (s, dir);
+      volatile GFC_REAL_4 r = MATHFUNC(nextafter) (s, dir);
       return r;
     }
   else
-    return nextafterf (s, dir);
+    return MATHFUNC(nextafter) (s, dir);
 }
 
 #endif
index 40e6590252b2338e848be4e3fce42a779e7d7ae0..8ac00b17c6d85002ccfa269bb406cf8e0c238d59 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_COPYSIGN) && defined (HAVE_NEXTAFTER)
 
 extern GFC_REAL_8 nearest_r8 (GFC_REAL_8 s, GFC_REAL_8 dir);
@@ -34,15 +37,15 @@ export_proto(nearest_r8);
 GFC_REAL_8
 nearest_r8 (GFC_REAL_8 s, GFC_REAL_8 dir)
 {
-  dir = copysign (__builtin_inf (), dir);
+  dir = MATHFUNC(copysign) (MATHFUNC(__builtin_inf) (), dir);
   if (FLT_EVAL_METHOD != 0)
     {
       /* ??? Work around glibc bug on x86.  */
-      volatile GFC_REAL_8 r = nextafter (s, dir);
+      volatile GFC_REAL_8 r = MATHFUNC(nextafter) (s, dir);
       return r;
     }
   else
-    return nextafter (s, dir);
+    return MATHFUNC(nextafter) (s, dir);
 }
 
 #endif
index 64cf404e0a653d094183fa4c01d9e0ff7e836c64..475a8cfa11049560660c32a8c4532804ceabe61c 100644 (file)
@@ -29,7 +29,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
-#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10)
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10) && defined (HAVE_SQRTL) && defined (HAVE_FABSL)
+
+#define MATHFUNC(funcname) funcname ## l
 
 
 extern void norm2_r10 (gfc_array_r10 * const restrict, 
@@ -144,23 +147,23 @@ norm2_r10 (gfc_array_r10 * const restrict retarray,
       {
 
        GFC_REAL_10 scale;
-       result = 0.0L;
-       scale = 1.0L;
+       result = 0;
+       scale = 1;
        if (len <= 0)
-         *dest = 0.0L;
+         *dest = 0;
        else
          {
            for (n = 0; n < len; n++, src += delta)
              {
 
-         if (*src != 0.0L)
+         if (*src != 0)
            {
              GFC_REAL_10 absX, val;
-             absX = fabsl (*src);
+             absX = MATHFUNC(fabs) (*src);
              if (scale < absX)
                {
                  val = scale / absX;
-                 result = 1.0L + result * val * val;
+                 result = 1 + result * val * val;
                  scale = absX;
                }
              else
@@ -170,7 +173,7 @@ norm2_r10 (gfc_array_r10 * const restrict retarray,
                }
            }
              }
-           result = scale * sqrtl (result);
+           result = scale * MATHFUNC(sqrt) (result);
            *dest = result;
          }
       }
index 1fc79ae278ba4bda537654376dfffab537a95a4e..acd57790a3d6087b0d400d11f727b2e1722fec3c 100644 (file)
@@ -29,7 +29,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16)
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SQRTL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL))
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
 
 
 extern void norm2_r16 (gfc_array_r16 * const restrict, 
@@ -144,23 +151,23 @@ norm2_r16 (gfc_array_r16 * const restrict retarray,
       {
 
        GFC_REAL_16 scale;
-       result = 0.0L;
-       scale = 1.0L;
+       result = 0;
+       scale = 1;
        if (len <= 0)
-         *dest = 0.0L;
+         *dest = 0;
        else
          {
            for (n = 0; n < len; n++, src += delta)
              {
 
-         if (*src != 0.0L)
+         if (*src != 0)
            {
              GFC_REAL_16 absX, val;
-             absX = fabsl (*src);
+             absX = MATHFUNC(fabs) (*src);
              if (scale < absX)
                {
                  val = scale / absX;
-                 result = 1.0L + result * val * val;
+                 result = 1 + result * val * val;
                  scale = absX;
                }
              else
@@ -170,7 +177,7 @@ norm2_r16 (gfc_array_r16 * const restrict retarray,
                }
            }
              }
-           result = scale * sqrtl (result);
+           result = scale * MATHFUNC(sqrt) (result);
            *dest = result;
          }
       }
index 78f28dc77fd08bb1fad004cb79995e51e99d9175..83e034fa613dea663fda8730ac996df53a5e6d3e 100644 (file)
@@ -29,7 +29,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
-#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4) && defined (HAVE_SQRTF) && defined (HAVE_FABSF)
+
+#define MATHFUNC(funcname) funcname ## f
 
 
 extern void norm2_r4 (gfc_array_r4 * const restrict, 
@@ -144,23 +147,23 @@ norm2_r4 (gfc_array_r4 * const restrict retarray,
       {
 
        GFC_REAL_4 scale;
-       result = 0.0F;
-       scale = 1.0F;
+       result = 0;
+       scale = 1;
        if (len <= 0)
-         *dest = 0.0F;
+         *dest = 0;
        else
          {
            for (n = 0; n < len; n++, src += delta)
              {
 
-         if (*src != 0.0F)
+         if (*src != 0)
            {
              GFC_REAL_4 absX, val;
-             absX = fabsf (*src);
+             absX = MATHFUNC(fabs) (*src);
              if (scale < absX)
                {
                  val = scale / absX;
-                 result = 1.0F + result * val * val;
+                 result = 1 + result * val * val;
                  scale = absX;
                }
              else
@@ -170,7 +173,7 @@ norm2_r4 (gfc_array_r4 * const restrict retarray,
                }
            }
              }
-           result = scale * sqrtf (result);
+           result = scale * MATHFUNC(sqrt) (result);
            *dest = result;
          }
       }
index fd9aba7416d211ef7dd0dccf4565ba39ce9a1c06..88599e83c7f1a2f4cdcbf8f429c07d8595f7b2bd 100644 (file)
@@ -29,7 +29,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <assert.h>
 
 
-#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8)
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8) && defined (HAVE_SQRT) && defined (HAVE_FABS)
+
+#define MATHFUNC(funcname) funcname
 
 
 extern void norm2_r8 (gfc_array_r8 * const restrict, 
@@ -144,23 +147,23 @@ norm2_r8 (gfc_array_r8 * const restrict retarray,
       {
 
        GFC_REAL_8 scale;
-       result = 0.0;
-       scale = 1.0;
+       result = 0;
+       scale = 1;
        if (len <= 0)
-         *dest = 0.0;
+         *dest = 0;
        else
          {
            for (n = 0; n < len; n++, src += delta)
              {
 
-         if (*src != 0.0)
+         if (*src != 0)
            {
              GFC_REAL_8 absX, val;
-             absX = fabs (*src);
+             absX = MATHFUNC(fabs) (*src);
              if (scale < absX)
                {
                  val = scale / absX;
-                 result = 1.0 + result * val * val;
+                 result = 1 + result * val * val;
                  scale = absX;
                }
              else
@@ -170,7 +173,7 @@ norm2_r8 (gfc_array_r8 * const restrict retarray,
                }
            }
              }
-           result = scale * sqrt (result);
+           result = scale * MATHFUNC(sqrt) (result);
            *dest = result;
          }
       }
index 1889d0ffcf1e4dd2a8025082abefe45c26bfa51f..298c9d1388bdeedaef74235ad44bc0d431e61328 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_FABSL) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 rrspacing_r10 (GFC_REAL_10 s, int p);
@@ -36,14 +39,14 @@ rrspacing_r10 (GFC_REAL_10 s, int p)
 {
   int e;
   GFC_REAL_10 x;
-  x = fabsl (s);
+  x = MATHFUNC(fabs) (s);
   if (x == 0.)
     return 0.;
-  frexpl (s, &e);
+  MATHFUNC(frexp) (s, &e);
 #if defined (HAVE_LDEXPL)
-  return ldexpl (x, p - e);
+  return MATHFUNC(ldexp) (x, p - e);
 #else
-  return scalbnl (x, p - e);
+  return MATHFUNC(scalbn) (x, p - e);
 #endif
 
 }
index 10de2448ebfa399dc97bc24fd13b819f4646ccbf..3812435ba807b2623462169a5f7701fc0fd2fdbb 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FABSL) && defined (HAVE_FREXPL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
 
 extern GFC_REAL_16 rrspacing_r16 (GFC_REAL_16 s, int p);
 export_proto(rrspacing_r16);
@@ -36,14 +43,14 @@ rrspacing_r16 (GFC_REAL_16 s, int p)
 {
   int e;
   GFC_REAL_16 x;
-  x = fabsl (s);
+  x = MATHFUNC(fabs) (s);
   if (x == 0.)
     return 0.;
-  frexpl (s, &e);
-#if defined (HAVE_LDEXPL)
-  return ldexpl (x, p - e);
+  MATHFUNC(frexp) (s, &e);
+#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL))
+  return MATHFUNC(ldexp) (x, p - e);
 #else
-  return scalbnl (x, p - e);
+  return MATHFUNC(scalbn) (x, p - e);
 #endif
 
 }
index 48683db343f56615fcc037e288228c5d92465517..74a2826065b4ba53b1a8b3c6393bb44aed7b9e58 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_FABSF) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 rrspacing_r4 (GFC_REAL_4 s, int p);
@@ -36,14 +39,14 @@ rrspacing_r4 (GFC_REAL_4 s, int p)
 {
   int e;
   GFC_REAL_4 x;
-  x = fabsf (s);
+  x = MATHFUNC(fabs) (s);
   if (x == 0.)
     return 0.;
-  frexpf (s, &e);
+  MATHFUNC(frexp) (s, &e);
 #if defined (HAVE_LDEXPF)
-  return ldexpf (x, p - e);
+  return MATHFUNC(ldexp) (x, p - e);
 #else
-  return scalbnf (x, p - e);
+  return MATHFUNC(scalbn) (x, p - e);
 #endif
 
 }
index 75f2244551cf91efc9f8a12dd18965e17e96f347..cf3641893078607e5774e36ab9e27b0842056584 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_FABS) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 rrspacing_r8 (GFC_REAL_8 s, int p);
@@ -36,14 +39,14 @@ rrspacing_r8 (GFC_REAL_8 s, int p)
 {
   int e;
   GFC_REAL_8 x;
-  x = fabs (s);
+  x = MATHFUNC(fabs) (s);
   if (x == 0.)
     return 0.;
-  frexp (s, &e);
+  MATHFUNC(frexp) (s, &e);
 #if defined (HAVE_LDEXP)
-  return ldexp (x, p - e);
+  return MATHFUNC(ldexp) (x, p - e);
 #else
-  return scalbn (x, p - e);
+  return MATHFUNC(scalbn) (x, p - e);
 #endif
 
 }
index 3f5238ded518ca15176347a26e8988a9b00cf0e8..f6435f89b5009403ac0094c1dc998948c6d3bc66 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_SCALBNL) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 set_exponent_r10 (GFC_REAL_10 s, GFC_INTEGER_4 i);
@@ -35,7 +38,7 @@ GFC_REAL_10
 set_exponent_r10 (GFC_REAL_10 s, GFC_INTEGER_4 i)
 {
   int dummy_exp;
-  return scalbnl (frexpl (s, &dummy_exp), i);
+  return MATHFUNC(scalbn) (MATHFUNC(frexp) (s, &dummy_exp), i);
 }
 
 #endif
index 4cd1ed5a4413bda0dc655d9ed4b9cd914b198818..8842dad8993658df897a73b3ee01a9d0c013b96d 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_SCALBNL) && defined (HAVE_FREXPL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SCALBNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
 
 extern GFC_REAL_16 set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i);
 export_proto(set_exponent_r16);
@@ -35,7 +42,7 @@ GFC_REAL_16
 set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i)
 {
   int dummy_exp;
-  return scalbnl (frexpl (s, &dummy_exp), i);
+  return MATHFUNC(scalbn) (MATHFUNC(frexp) (s, &dummy_exp), i);
 }
 
 #endif
index 4d765c2f0354311ffbaf115fde600c2a28920a2f..f88060237e8701344739f82c2b1248d89f86baaf 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_SCALBNF) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 set_exponent_r4 (GFC_REAL_4 s, GFC_INTEGER_4 i);
@@ -35,7 +38,7 @@ GFC_REAL_4
 set_exponent_r4 (GFC_REAL_4 s, GFC_INTEGER_4 i)
 {
   int dummy_exp;
-  return scalbnf (frexpf (s, &dummy_exp), i);
+  return MATHFUNC(scalbn) (MATHFUNC(frexp) (s, &dummy_exp), i);
 }
 
 #endif
index ad8c3af5ebe7e5866d6f9d2a8472fb5b49dc7e5e..9d6fd1395a111943cf95b3a3febdb6e5ca4d6d75 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_SCALBN) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 set_exponent_r8 (GFC_REAL_8 s, GFC_INTEGER_4 i);
@@ -35,7 +38,7 @@ GFC_REAL_8
 set_exponent_r8 (GFC_REAL_8 s, GFC_INTEGER_4 i)
 {
   int dummy_exp;
-  return scalbn (frexp (s, &dummy_exp), i);
+  return MATHFUNC(scalbn) (MATHFUNC(frexp) (s, &dummy_exp), i);
 }
 
 #endif
index 10a907345f50f9dbd875a56b66c55fa1d7369e21..abf6784b3eedbbce30ebd783f30902e173f0f70e 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## l
+
 #if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 spacing_r10 (GFC_REAL_10 s, int p, int emin, GFC_REAL_10 tiny);
@@ -37,13 +40,13 @@ spacing_r10 (GFC_REAL_10 s, int p, int emin, GFC_REAL_10 tiny)
   int e;
   if (s == 0.)
     return tiny;
-  frexpl (s, &e);
+  MATHFUNC(frexp) (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
 #if defined (HAVE_LDEXPL)
-  return ldexpl (1., e);
+  return MATHFUNC(ldexp) (1., e);
 #else
-  return scalbnl (1., e);
+  return MATHFUNC(scalbn) (1., e);
 #endif
 }
 
index 82ef8353d49386a8910b553df4830cad8881b8e7..c95c0bafde853a6ee067859c327e24d2953d96c2 100644 (file)
@@ -26,7 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif
+
+#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
 
 extern GFC_REAL_16 spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny);
 export_proto(spacing_r16);
@@ -37,13 +44,13 @@ spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny)
   int e;
   if (s == 0.)
     return tiny;
-  frexpl (s, &e);
+  MATHFUNC(frexp) (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
-#if defined (HAVE_LDEXPL)
-  return ldexpl (1., e);
+#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL))
+  return MATHFUNC(ldexp) (1., e);
 #else
-  return scalbnl (1., e);
+  return MATHFUNC(scalbn) (1., e);
 #endif
 }
 
index 7936ba982bfc5c315255b57e92847b29de8f2234..2be2906536df0b5bc6801012c2983062847910c3 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname ## f
+
 #if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 spacing_r4 (GFC_REAL_4 s, int p, int emin, GFC_REAL_4 tiny);
@@ -37,13 +40,13 @@ spacing_r4 (GFC_REAL_4 s, int p, int emin, GFC_REAL_4 tiny)
   int e;
   if (s == 0.)
     return tiny;
-  frexpf (s, &e);
+  MATHFUNC(frexp) (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
 #if defined (HAVE_LDEXPF)
-  return ldexpf (1., e);
+  return MATHFUNC(ldexp) (1., e);
 #else
-  return scalbnf (1., e);
+  return MATHFUNC(scalbn) (1., e);
 #endif
 }
 
index 3debe49249c81f49e715f383a32b4b0c1e628f93..aa140b53e518f1df1eef179fd9347f618a662417 100644 (file)
@@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgfortran.h"
 
 
+
+#define MATHFUNC(funcname) funcname
+
 #if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 spacing_r8 (GFC_REAL_8 s, int p, int emin, GFC_REAL_8 tiny);
@@ -37,13 +40,13 @@ spacing_r8 (GFC_REAL_8 s, int p, int emin, GFC_REAL_8 tiny)
   int e;
   if (s == 0.)
     return tiny;
-  frexp (s, &e);
+  MATHFUNC(frexp) (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
 #if defined (HAVE_LDEXP)
-  return ldexp (1., e);
+  return MATHFUNC(ldexp) (1., e);
 #else
-  return scalbn (1., e);
+  return MATHFUNC(scalbn) (1., e);
 #endif
 }
 
index a4790dd8bf50b27f632e817c9d46d8221e319328..3df8f1d1849090b492100459b83d4a8962b0242b 100644 (file)
@@ -31,11 +31,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 include(iparm.m4)dnl
 include(`mtype.m4')dnl
 
+mathfunc_macro
+
 `#if defined (HAVE_'rtype_name`)
 
 
 
-#if defined (HAVE_JN'Q`)
+#if 'hasmathfunc(jn)`
 extern void bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1,
                                     int n2, 'rtype_name` x);
 export_proto(bessel_jn_r'rtype_kind`);
@@ -69,28 +71,28 @@ bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, 'rtype_na
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0'Q`))
+  if (unlikely (x == 0))
     {
-      ret->data[0] = 1.0'Q`;
+      ret->data[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0.0'Q`;
+        ret->data[i*stride] = 0;
       return;
     }
 
   ret->data = ret->data;
-  last1 = jn'q` (n2, x);
+  last1 = MATHFUNC(jn) (n2, x);
   ret->data[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = jn'q` (n2 - 1, x);
+  last2 = MATHFUNC(jn) (n2 - 1, x);
   ret->data[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0'Q`/x;
+  x2rev = GFC_REAL_'rtype_kind`_LITERAL(2.)/x;
 
   for (i = n2-n1-2; i >= 0; i--)
     {
@@ -102,7 +104,7 @@ bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, 'rtype_na
 
 #endif
 
-#if defined (HAVE_YN'Q`)
+#if 'hasmathfunc(yn)`
 extern void bessel_yn_r'rtype_kind` ('rtype` * const restrict ret,
                                     int n1, int n2, 'rtype_name` x);
 export_proto(bessel_yn_r'rtype_kind`);
@@ -137,7 +139,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (unlikely (x == 0.0'Q`))
+  if (unlikely (x == 0))
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined('rtype_name`_INFINITY)
@@ -149,19 +151,19 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2,
     }
 
   ret->data = ret->data;
-  last1 = yn'q` (n1, x);
+  last1 = MATHFUNC(yn) (n1, x);
   ret->data[0] = last1;
 
   if (n1 == n2)
     return;
 
-  last2 = yn'q` (n1 + 1, x);
+  last2 = MATHFUNC(yn) (n1 + 1, x);
   ret->data[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
-  x2rev = 2.0'Q`/x;
+  x2rev = GFC_REAL_'rtype_kind`_LITERAL(2.)/x;
 
   for (i = 2; i <= n1+n2; i++)
     {
index bb9cda8a15020d5c4cca9ae79334860ff91c3b0a..7302eb8b1a9af3062e2ae45c344ec43be00b5127 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(frexp)`
 
 extern GFC_INTEGER_4 exponent_r'kind` ('real_type` s);
 export_proto(exponent_r'kind`);
@@ -36,7 +38,7 @@ GFC_INTEGER_4
 exponent_r'kind` ('real_type` s)
 {
   int ret;
-  frexp'q` (s, &ret);
+  MATHFUNC(frexp) (s, &ret);
   return ret;
 }
 
index 2878127f52e056d930176158e02aabfc1422c85a..419e801321f177c04720dd7e23231834059106d5 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(frexp)`
 
 extern 'real_type` fraction_r'kind` ('real_type` s);
 export_proto(fraction_r'kind`);
@@ -36,7 +38,7 @@ export_proto(fraction_r'kind`);
 fraction_r'kind` ('real_type` s)
 {
   int dummy_exp;
-  return frexp'q` (s, &dummy_exp);
+  return MATHFUNC(frexp) (s, &dummy_exp);
 }
 
 #endif'
index 8e7e889bf0e720dbeb85c4cce3a71a8ebdc775de..fc4cecac5f5edf7416cece9aad64ac31ed91bb09 100644 (file)
@@ -2,5 +2,12 @@ dnl Get type kind from filename.
 define(kind,regexp(file, `_.\([0-9]+\).c$', `\1'))dnl
 define(complex_type, `GFC_COMPLEX_'kind)dnl
 define(real_type, `GFC_REAL_'kind)dnl
+define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl
 define(q,ifelse(kind,4,f,ifelse(kind,8,`',ifelse(kind,10,l,ifelse(kind,16,l,`_'kind)))))dnl
 define(Q,translit(q,`a-z',`A-Z'))dnl
+define(hasmathfunc,`ifelse(kind,4,`defined (HAVE_'upcase($1)`F)',ifelse(kind,8,`defined (HAVE_'upcase($1)`)',ifelse(kind,10,`defined (HAVE_'upcase($1)`L)',ifelse(kind,16,`(defined(GFC_WITH_QUAD_LIB) || defined(HAVE_'upcase($1)`L))',`error out'))))')
+define(mathfunc_macro,`ifelse(kind,16,`#if defined(GFC_REAL_16_IS_FLOAT128)
+#define MATHFUNC(funcname) funcname ## q
+#else
+#define MATHFUNC(funcname) funcname ## l
+#endif',ifelse(kind,8,``#''`define MATHFUNC(funcname) funcname',```#'''`define MATHFUNC(funcname) funcname '```#'''```#'''` 'q))')dnl
index 98b417f3cba0cc5dd93184bafaa9626bc8602423..8fbe5000794ce3baa0bf1f4b375c084b9fa204ab 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_COPYSIGN'Q`) && defined (HAVE_NEXTAFTER'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(copysign) && hasmathfunc(nextafter)`
 
 extern 'real_type` nearest_r'kind` ('real_type` s, 'real_type` dir);
 export_proto(nearest_r'kind`);
@@ -35,15 +37,15 @@ export_proto(nearest_r'kind`);
 'real_type`
 nearest_r'kind` ('real_type` s, 'real_type` dir)
 {
-  dir = copysign'q` (__builtin_inf'q` (), dir);
+  dir = MATHFUNC(copysign) (MATHFUNC(__builtin_inf) (), dir);
   if (FLT_EVAL_METHOD != 0)
     {
       /* ??? Work around glibc bug on x86.  */
-      volatile 'real_type` r = nextafter'q` (s, dir);
+      volatile 'real_type` r = MATHFUNC(nextafter) (s, dir);
       return r;
     }
   else
-    return nextafter'q` (s, dir);
+    return MATHFUNC(nextafter) (s, dir);
 }
 
 #endif'
index e1d6b972df4a30bdbd4a7ecfdd80ee28ff9f5ca0..b2162ac23ed4bce4372d4a7aba26f57d3fdf6e55 100644 (file)
@@ -32,20 +32,22 @@ include(iparm.m4)dnl
 include(ifunction.m4)dnl
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`) && 'hasmathfunc(sqrt) && hasmathfunc(fabs)
 
-ARRAY_FUNCTION(`0.0'Q,
+mathfunc_macro
+
+ARRAY_FUNCTION(0,
 `      'rtype_name` scale;
-       result = 0.0'Q`;
-       scale = 1.0'Q`;',
-`        if (*src != 0.0'Q`)
+       result = 0;
+       scale = 1;',
+`        if (*src != 0)
            {
              'rtype_name` absX, val;
-             absX = fabs'q` (*src);
+             absX = MATHFUNC(fabs) (*src);
              if (scale < absX)
                {
                  val = scale / absX;
-                 result = 1.0'Q` + result * val * val;
+                 result = 1 + result * val * val;
                  scale = absX;
                }
              else
@@ -54,6 +56,6 @@ ARRAY_FUNCTION(`0.0'Q,
                  result += val * val;
                }
            }',
-`   result = scale * sqrt'q` (result);')
+`   result = scale * MATHFUNC(sqrt) (result);')
 
 #endif
index f66bb3b758e60daf7f65ffc05e9a5b92c79fc3dc..3d75c66fa22074dd0279ebd29379d81c64fcfa3e 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FABS'Q`) && defined (HAVE_FREXP'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(fabs) && hasmathfunc(frexp)`
 
 extern 'real_type` rrspacing_r'kind` ('real_type` s, int p);
 export_proto(rrspacing_r'kind`);
@@ -37,14 +39,14 @@ rrspacing_r'kind` ('real_type` s, int p)
 {
   int e;
   'real_type` x;
-  x = fabs'q` (s);
+  x = MATHFUNC(fabs) (s);
   if (x == 0.)
     return 0.;
-  frexp'q` (s, &e);
-#if defined (HAVE_LDEXP'Q`)
-  return ldexp'q` (x, p - e);
+  MATHFUNC(frexp) (s, &e);
+#if 'hasmathfunc(ldexp)`
+  return MATHFUNC(ldexp) (x, p - e);
 #else
-  return scalbn'q` (x, p - e);
+  return MATHFUNC(scalbn) (x, p - e);
 #endif
 
 }
index 84200fd339bd3dbba27dd53942e9ed47fe2a4044..0d35d11c875a4d7846823f3322d5f54e8b393d4d 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_SCALBN'Q`) && defined (HAVE_FREXP'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(scalbn) && hasmathfunc(frexp)`
 
 extern 'real_type` set_exponent_r'kind` ('real_type` s, GFC_INTEGER_4 i);
 export_proto(set_exponent_r'kind`);
@@ -36,7 +38,7 @@ export_proto(set_exponent_r'kind`);
 set_exponent_r'kind` ('real_type` s, GFC_INTEGER_4 i)
 {
   int dummy_exp;
-  return scalbn'q` (frexp'q` (s, &dummy_exp), i);
+  return MATHFUNC(scalbn) (MATHFUNC(frexp) (s, &dummy_exp), i);
 }
 
 #endif'
index 62fa739c7888e085c6400057c631ac6d04e8fecf..9b43b740262b28a1f41c552549e37e359232d854 100644 (file)
@@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)
+mathfunc_macro
+
+`#if defined (HAVE_'real_type`) && 'hasmathfunc(frexp)`
 
 extern 'real_type` spacing_r'kind` ('real_type` s, int p, int emin, 'real_type` tiny);
 export_proto(spacing_r'kind`);
@@ -38,13 +40,13 @@ spacing_r'kind` ('real_type` s, int p, int emin, 'real_type` tiny)
   int e;
   if (s == 0.)
     return tiny;
-  frexp'q` (s, &e);
+  MATHFUNC(frexp) (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
-#if defined (HAVE_LDEXP'Q`)
-  return ldexp'q` (1., e);
+#if 'hasmathfunc(ldexp)`
+  return MATHFUNC(ldexp) (1., e);
 #else
-  return scalbn'q` (1., e);
+  return MATHFUNC(scalbn) (1., e);
 #endif
 }
 
This page took 0.170138 seconds and 5 git commands to generate.