diff options
Diffstat (limited to 'gcc/fortran/arith.c')
-rw-r--r-- | gcc/fortran/arith.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index d4c527fb356..f130344930e 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) |