mtype.m4 (upcase, [...]): New macros.

* 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
This commit is contained in:
Francois-Xavier Coudert 2010-08-28 22:10:52 +00:00 committed by François-Xavier Coudert
parent bf321310b1
commit 08fd13d447
42 changed files with 370 additions and 175 deletions

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

View 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++)
{

View 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++)
{

View 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++)
{

View 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++)
{

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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
}

View 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
}

View 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
}

View 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
}

View 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

View 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

View 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

View 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

View 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
}

View 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
}

View 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
}

View 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
}

View 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++)
{

View 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;
}

View 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'

View 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

View 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'

View 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

View 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
}

View 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'

View 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
}