This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Improve clog, clog10 handling of values with real or imaginary part 1 (bug 13629)


On Wednesday, July 25, 2012 19:18:30 Joseph S. Myers wrote:
> Bug 13629 describes problems with clog near z=1 - which actually apply
> anywhere near |z|=1, as then the implementation is calling log for a
> value close to 1.
> 
> This patch fixes some of those cases (for both clog and clog10): those
> where either the real or imaginary part has absolute value equal to 1
> (and the other part is small).  Those are the only cases where, for
> IEEE arithmetic, underflow may validly occur in computing the real
> part of the result, and so it's natural to deal with them separately
> from the other cases of |z|=1.  If x is 1, then the desired real part
> is log1p(y*y)/2 - there is an additional complication to ensure
> underflow exceptions in the case where log1p returns a normal value
> and the division by 2 happens to be exact (and this is further
> complicated on x86 by excess precision where underflow for float or
> double sometimes only occurs when the result actually gets converted
> to that type, not for intermediate computations).
> 
> The remaining cases to fix separately are, I think, the case where the
> larger of the real and imaginary parts has absolute value above 1 but
> close to it (where log1p ((x-1)*(x+1) + y*y) will essentially work,
> subject to avoiding spurious underflow in calculating y*y), and the
> case where both have absolute value less than 1 but |z| is close to 1
> (requiring precision extension techniques for the intermediate
> calculation of x*x + y*y - 1, I think).
> 
> Tested x86 and x86_64 and ulps updated accordingly.
> 
> 2012-07-25  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #13629]
> 	* math/s_clog.c (__clog): Use __log1p or direct log1p calculation
> 	if larger part has absolute value 1.0.
> 	* math/s_clog10.c (__clog10): Likewise.
> 	* math/s_clog10f.c (__clog10f): Likewise.
> 	* math/s_clog10l.c (__clog10l): Likewise.
> 	* math/s_clogf.c (__clogf): Likewise.
> 	* math/s_clogl.c (__clogl): Likewise.
> 	* math/libm-test.inc (clog_test): Add more tests.
> 	(clog10_test): Likewise.
> 	* sysdeps/i386/fpu/libm-test-ulps: Update.
> 	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.


Thanks, this is ok,

Andreas
-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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