This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Change definition of complex::norm
- To: HJSTEIN at bloomberg dot com (Harvey J. Stein)
- Subject: Re: Change definition of complex::norm
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Thu, 1 Nov 2001 12:02:49 -0500 (EST)
- Cc: lucier at math dot purdue dot edu (Brad Lucier), gcc at gcc dot gnu dot org, nbecker at fred dot net, gdr at codesourcery dot com, bkoz at redhat dot com
> Wouldn't this be a little better:
>
> double
> abs_3(double x, double y) {
>
> double abs_x = (x > 0. ? x : -x);
> double abs_y = (y > 0. ? y : -y);
> double s, min;
>
> if (abs_x > abs_y) {
> s = abs_x;
> min = y;
> } else {
> s = abs_y;
> min = x;
> }
> if (s == 0.)
> return s;
>
> min /= s;
>
> return s * sqrt( 1 + min * min);
> }
Absolutely. I was trying to minimize the differences between the
two routines to highlight the result of a single difference.
Brad