This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] use numerically safe algorithm for folding CABS


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]