diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-06 23:16:43 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-06 23:16:43 +0000 |
commit | 5c50ce6234b2fbab98643799d865a7db7c1bb1ad (patch) | |
tree | d32fe02580ebb8b9e04104f199396953a5678b02 /gcc | |
parent | e335d51286f576bcd9035ff20d6e0b33ee7f6049 (diff) | |
download | gcc-5c50ce6234b2fbab98643799d865a7db7c1bb1ad.tar.gz |
* simplify.c (gfc_simplify_abs): Use mpfr_hypot for CABS.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88647 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 13 |
2 files changed, 4 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d52914f419a..276e5864b8b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -4,6 +4,8 @@ * simplify.c (twos_complement): New function. (gfc_simplify_ishft, gfc_simplify_ishftc): Revise. + * simplify.c (gfc_simplify_abs): Use mpfr_hypot for CABS. + 2004-10-06 Paul Brook <paul@codesourcery.com> * trans-stmt.c (gfc_trans_simple_do): New function. diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 0ac9d618bd2..253f68677a1 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -176,7 +176,6 @@ gfc_expr * gfc_simplify_abs (gfc_expr * e) { gfc_expr *result; - mpfr_t a, b; if (e->expr_type != EXPR_CONSTANT) return NULL; @@ -203,17 +202,9 @@ gfc_simplify_abs (gfc_expr * e) result = gfc_constant_result (BT_REAL, e->ts.kind, &e->where); gfc_set_model_kind (e->ts.kind); - mpfr_init (a); - mpfr_init (b); - /* FIXME: Possible numerical problems. */ - mpfr_mul (a, e->value.complex.r, e->value.complex.r, GFC_RND_MODE); - mpfr_mul (b, e->value.complex.i, e->value.complex.i, GFC_RND_MODE); - mpfr_add (a, a, b, GFC_RND_MODE); - mpfr_sqrt (result->value.real, a, GFC_RND_MODE); - - mpfr_clear (a); - mpfr_clear (b); + mpfr_hypot (result->value.real, e->value.complex.r, + e->value.complex.i, GFC_RND_MODE); result = range_check (result, "CABS"); break; |