aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/arith.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2006-10-28 23:31:22 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2006-10-28 23:31:22 +0000
commitb814a64ea1fd82823841ba0ac5d2ec6248429828 (patch)
tree92aa54b723fbf8259a3029a5c5e269278d1d32ca /gcc/fortran/arith.c
parent857d325a640ab62412800b36a89f82f0e424db68 (diff)
downloadgcc-b814a64ea1fd82823841ba0ac5d2ec6248429828.zip
gcc-b814a64ea1fd82823841ba0ac5d2ec6248429828.tar.gz
gcc-b814a64ea1fd82823841ba0ac5d2ec6248429828.tar.bz2
gfortran.h: Remove GFC_MPFR_TOO_OLD.
2006-10-27 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.h: Remove GFC_MPFR_TOO_OLD. * arith.c (arctangent2): Remove function (gfc_check_real_range): Remove subnormal kludge. * arith.h: Remove arctangent2 prototype. * simplify.c: (gfc_simplify_atan2): Remove use of arctangent2. (gfc_simplify_exponent, gfc_simplify_log, gfc_simplify_nearest, gfc_simplify_rrspacing, gfc_simplify_spacing): Remove mpfr kludges. From-SVN: r118120
Diffstat (limited to 'gcc/fortran/arith.c')
-rw-r--r--gcc/fortran/arith.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index d4c527f..f130344 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -75,57 +75,6 @@ gfc_set_model (mpfr_t x)
mpfr_set_default_prec (mpfr_get_prec (x));
}
-#if defined(GFC_MPFR_TOO_OLD)
-/* Calculate atan2 (y, x)
-
-atan2(y, x) = atan(y/x) if x > 0,
- sign(y)*(pi - atan(|y/x|)) if x < 0,
- 0 if x = 0 && y == 0,
- sign(y)*pi/2 if x = 0 && y != 0.
-*/
-
-void
-arctangent2 (mpfr_t y, mpfr_t x, mpfr_t result)
-{
- int i;
- mpfr_t t;
-
- gfc_set_model (y);
- mpfr_init (t);
-
- i = mpfr_sgn (x);
-
- if (i > 0)
- {
- mpfr_div (t, y, x, GFC_RND_MODE);
- mpfr_atan (result, t, GFC_RND_MODE);
- }
- else if (i < 0)
- {
- mpfr_const_pi (result, GFC_RND_MODE);
- mpfr_div (t, y, x, GFC_RND_MODE);
- mpfr_abs (t, t, GFC_RND_MODE);
- mpfr_atan (t, t, GFC_RND_MODE);
- mpfr_sub (result, result, t, GFC_RND_MODE);
- if (mpfr_sgn (y) < 0)
- mpfr_neg (result, result, GFC_RND_MODE);
- }
- else
- {
- if (mpfr_sgn (y) == 0)
- mpfr_set_ui (result, 0, GFC_RND_MODE);
- else
- {
- mpfr_const_pi (result, GFC_RND_MODE);
- mpfr_div_ui (result, result, 2, GFC_RND_MODE);
- if (mpfr_sgn (y) < 0)
- mpfr_neg (result, result, GFC_RND_MODE);
- }
- }
-
- mpfr_clear (t);
-}
-#endif
/* Given an arithmetic error code, return a pointer to a string that
explains the error. */
@@ -412,31 +361,6 @@ gfc_check_real_range (mpfr_t p, int kind)
}
else if (mpfr_cmp (q, gfc_real_kinds[i].tiny) < 0)
{
-#if defined(GFC_MPFR_TOO_OLD)
- /* 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
- precision. This code resets unused bits to 0 to alleviate
- rounding problems. Note, a future version of MPFR will have a
- mpfr_subnormalize() function, which handles this truncation in a
- more efficient and robust way. */
-
- int j, k;
- char *bin, *s;
- mp_exp_t e;
-
- bin = mpfr_get_str (NULL, &e, gfc_real_kinds[i].radix, 0, q, GMP_RNDN);
- k = gfc_real_kinds[i].digits - (gfc_real_kinds[i].min_exponent - e);
- for (j = k; j < gfc_real_kinds[i].digits; j++)
- bin[j] = '0';
- /* Need space for '0.', bin, 'E', and e */
- s = (char *) gfc_getmem (strlen(bin) + 10);
- sprintf (s, "0.%sE%d", bin, (int) e);
- mpfr_set_str (q, s, gfc_real_kinds[i].radix, GMP_RNDN);
-
- gfc_free (s);
- gfc_free (bin);
-#else
mp_exp_t emin, emax;
int en;
@@ -453,7 +377,6 @@ gfc_check_real_range (mpfr_t p, int kind)
/* Reset emin and emax. */
mpfr_set_emin (emin);
mpfr_set_emax (emax);
-#endif
/* Copy sign if needed. */
if (mpfr_sgn (p) < 0)