This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Change definition of complex::norm
- To: gdr at codesourcery dot com (Gabriel Dos Reis)
- Subject: Re: Change definition of complex::norm
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Thu, 1 Nov 2001 14:24:25 -0500 (EST)
- Cc: lucier at math dot purdue dot edu (Brad Lucier), gdr at codesourcery dot com (Gabriel Dos Reis), gcc at gcc dot gnu dot org, hjstein at bloomberg dot com, nbecker at fred dot net, bkoz at redhat dot com
>
> Brad Lucier <lucier@math.purdue.edu> writes:
>
> | > | is
> | > | that the formula
> | > |
> | > | norm(z) = real(z)^2 + imag(z)^2
> | > |
> | > | does give good relative error for normal results, and good absolute
> | > | error for denormal results.
> | >
> | > This isn't the case in the test you posted. Did I misread it?
> |
> | This *is* the case for the test I posted. The difference between
> | 0 and 4.whatever\times e-324 is within the absolute error of
> | denormal results.
>
> I recall the part of your assertion I agreed with
>
> # The relevant error tolerance when calculating a quantity x is roughly
> #
> # \max (|x| * 2^{-53}, 2^{-53-1024})
>
> # The first quantity is the relative tolerance, the second is the absolute
> # tolerance for numbers in the denormal range. One would like the
> # computation of any quantity x to be within a small multiple of this
> # tolerance. There can also be qualitative issues---returning a finite
> # answer as often as possible, etc.
>
> 2^{-53-1024} is about 0.6175820573e-324. I guess one of the point
> of our disagreement is whether a factor of about 7 or 8 is considered
> "small".
Sorry, I forgot that the exponent range is not symmetric, the formula I
gave for the absolute error tolerance is incorrect. The smallest
nonzero denormal in double precision IEEE is 4.940656e-324. And in the
example I gave, the answer in exact arithmetic is exactly halfway between
4.940656e-324 and 0.0, so there is little to choose between them.
Brad