This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Change definition of complex::norm
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Subject: Re: Change definition of complex::norm
- From: nbecker at fred dot net
- Date: 01 Nov 2001 08:25:10 -0500
- Cc: gcc at gcc dot gnu dot org, hjstein at bloomberg dot com, gdr at codesourcery dot com, bkoz at redhat dot com
- References: <200111010245.fA12jbk17021@banach.math.purdue.edu>
>>>>> "Brad" == Brad Lucier <lucier@math.purdue.edu> writes:
Brad> I've done a bit of investigation, and can offer some information
Brad> and suggestions, but someone else will need to generate the patch,
Brad> as I know very little about this part of C++.
Brad> First, I find the following statement in the standard:
>> 26.2 Complex numbers [lib.complex.numbers]
>> ...
>> 2 The effect of instantiating the template complex for any type other than
>> float, double or long double is unspecified.
Brad> Point (2) seems to turn the issue of implementation of <complex> templates
Brad> and operations for, e.g., int or long, into a QOI issue. So, the point of
Brad> nbecker@fred.net:
>> 1) the current definition is not as useful, since it only works where
>> sqrt is defined
Brad> is true, but is perhaps not relevant.
Just because the standard leaves it up to the implementation doesn't
mean we are obliged to take the narrowest interpretation. I see no
harm in defining norm(z) = sqr (real(z)) + sqr (imag (z)).