This is the mail archive of the 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]

Re: definition of complex norm

----- Original Message -----
From: <>
To: <>
Cc: <>
Sent: Thursday, November 01, 2001 5:34 AM
Subject: definition of complex norm

> In the current gcc, norm of complex is defined in terms of abs.  I
> believe the definition should be changed to:
> norm(z) = sqr(real(z)) + sqr (imag (z))
> My reasons are:
> 1. More efficient
> 2. Works for complex<int> (important in DSP)
> 3. Possibly more accurate
> I have started a discussion on on this subject.  I'm
> wondering if any of you have an opinion.

If this is a library issue, there won't be much patience with it on this
list.  Even commonly used functions required by C89 are left to the
library implementors.

I suppose that the usual strategy (not followed by glibc with -O and -O2)
is to supply an implementation which doesn't break with boundary values,
and leave it up to the programmer to plug in her own version, if better
speed or accuracy is wanted.

Since complex absolute value requires your function, it is a fairly
widespread issue, well known over the years, and influential in the
design of the x87 and 68xxx processors which provide means of avoiding
over/underflow on double boundary values.  gcc doesn't like to go into
this much processor-dependent detail.

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