This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] use numerically safe algorithm for folding CABS
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: GCC Fortran mailing list <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 Oct 2004 22:04:10 +0000 (UTC)
- Subject: Re: [gfortran] use numerically safe algorithm for folding CABS
- References: <416469FB.8040704@physik.uni-muenchen.de>
On Wed, 6 Oct 2004, [ISO-8859-1] Tobias Schlüter wrote:
> This fixes a TODO from simplify.c, we used the naive algorithm for calculating
> the absolute value of a complex number. I replaced this by a standard textbook
> algorithm.
Can't you use mpfr_hypot?
In general, if you find yourself implementing a standard numerical
function it would be a good idea to try to contribute an implementation of
it to MPFR so in future gfortran can use the MPFR implementation rather
than needing its own. But in this case it looks like MPFR already has the
function.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)