[gfortran] use numerically safe algorithm for folding CABS

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Wed Oct 6 22:46:00 GMT 2004


Joseph S. Myers wrote:
> 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?

No, I can't because the version of mpfr distributed with GMP doesn't have it.
One more reason to import mpfr into the GCC tree, I assume. I will add a
comment pointing out that this code can be replaced when we import mpfr into
the tree.

> 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.

I totally agree with this.

- Tobi



More information about the Gcc-patches mailing list