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 Lucier <lucier@math.purdue.edu> writes:

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

But, when using (1.5e-162, 1.5e-162) as Z instead of
(sqrt(4.94e-324)/2,sqrt(4.94e-324)/2), the abs()^2 code still returns
4.94e-324, and the x^2+y^2 code still returns 0, but now the abs()^2
code is closer.  BTW, a normalized abs()^2 version also returns
4.94e-324, so maybe that's preferrable.

-- 
Harvey Stein
Bloomberg LP
hjstein@bloomberg.com


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