From 48c7b142f9e32a5332f2332ecd401f199034dbc6 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Thu, 28 Sep 2006 19:31:37 +0000 Subject: [PATCH] arith.c: Change conditional test for inclusion of arctangent(). 2006-09-28 Steven G. Kargl * arith.c: Change conditional test for inclusion of arctangent(). (gfc_check_real_range): Change conditional test for use of mpfr_subnormalize. * simplify.c (gfc_simplify_atan2): Fix conditional for use of mpfr_atan2() instead of arctangent(). (gfc_simplify_exponent): Fix conditional for use of mpfr_get_exp(). (gfc_simplify_log): Fix conditional for use of mpfr_atan2() instead of arctangent(). (gfc_simplify_nearest): Fix conditional for use of mpfr_nextafter(). From-SVN: r117289 --- gcc/fortran/ChangeLog | 12 ++++++++++++ gcc/fortran/arith.c | 4 ++-- gcc/fortran/simplify.c | 12 ++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 08de524a63d..8f2e3c34f4d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2006-09-28 Steven G. Kargl + + * arith.c: Change conditional test for inclusion of arctangent(). + (gfc_check_real_range): Change conditional test for use of + mpfr_subnormalize. + * simplify.c (gfc_simplify_atan2): Fix conditional for use of + mpfr_atan2() instead of arctangent(). + (gfc_simplify_exponent): Fix conditional for use of mpfr_get_exp(). + (gfc_simplify_log): Fix conditional for use of mpfr_atan2() instead + of arctangent(). + (gfc_simplify_nearest): Fix conditional for use of mpfr_nextafter(). + 2006-09-27 Steven G. Kargl * arith.c: Conditionally include arctangent2(). diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index 53f1262f9af..086ec4dbb38 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -75,7 +75,7 @@ gfc_set_model (mpfr_t x) mpfr_set_default_prec (mpfr_get_prec (x)); } -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) /* Calculate atan2 (y, x) atan2(y, x) = atan(y/x) if x > 0, @@ -408,7 +408,7 @@ gfc_check_real_range (mpfr_t p, int kind) } else if (mpfr_cmp (q, gfc_real_kinds[i].tiny) < 0) { -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) /* MPFR operates on a number with a given precision and enormous exponential range. To represent subnormal numbers, the exponent is allowed to become smaller than emin, but always retains the full diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index c448db6f8b7..c9ca2300a67 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -607,7 +607,7 @@ gfc_simplify_atan2 (gfc_expr * y, gfc_expr * x) return &gfc_bad_expr; } -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) arctangent2 (y->value.real, x->value.real, result->value.real); #else mpfr_atan2 (result->value.real, y->value.real, x->value.real, GFC_RND_MODE); @@ -1060,7 +1060,7 @@ gfc_simplify_exponent (gfc_expr * x) int i; gfc_expr *result; -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) mpfr_t tmp; #endif @@ -1078,7 +1078,7 @@ gfc_simplify_exponent (gfc_expr * x) return result; } -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) /* PR fortran/28276 suffers from a buggy MPFR, and this block of code does not function correctly. */ mpfr_init (tmp); @@ -2161,7 +2161,7 @@ gfc_simplify_log (gfc_expr * x) mpfr_init (xr); mpfr_init (xi); -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) arctangent2 (x->value.complex.i, x->value.complex.r, result->value.complex.i); #else mpfr_atan2 (result->value.complex.i, x->value.complex.i, x->value.complex.r, @@ -2495,7 +2495,7 @@ gfc_simplify_nearest (gfc_expr * x, gfc_expr * s) gfc_expr *result; mpfr_t tmp; int sgn; -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) int direction; #else mp_exp_t emin, emax; @@ -2513,7 +2513,7 @@ gfc_simplify_nearest (gfc_expr * x, gfc_expr * s) gfc_set_model_kind (x->ts.kind); result = gfc_copy_expr (x); -#if !defined(MPFR_VERSION_MAJOR) +#if MPFR_VERSION_MAJOR < 2 || (MPFR_VERSION_MAJOR == 2 && MPFR_VERSION_MINOR < 2) direction = mpfr_sgn (s->value.real); sgn = mpfr_sgn (x->value.real);