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

Re: Change definition of complex::norm


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


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