Commit Graph

16 Commits

Author SHA1 Message Date
Joseph Myers 6f05bafeba Fix clog / clog10 sign of zero result in round-downward mode (bug 16789).
This patch fixes bug 16789, incorrect sign of (real part) zero result
from clog and clog10 in round-downward mode, arising from that real
part being computed as 0 - 0.  To ensure that an underflow exception
occurred, the code used an underflowing value (the next term in the
series for log1p) in arithmetic computing the real part of the result,
yielding the problematic 0 - 0 computation in some cases even when the
mathematical result would be small but positive.  The patch changes
this code to use the math_force_eval approach to ensuring that an
underflowing computation actually occurs.  Tests of clog and clog10
are enabled in all rounding modes.

Tested x86_64 and x86 and ulps updated accordingly.

	[BZ #16789]
	* math/s_clog.c (__clog): Use math_force_eval to ensure underflow
	instead of using underflowing value in computing result.
	* 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): Use ALL_RM_TEST.
	(clog10_test): Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-04-02 13:10:19 +00:00
Joseph Myers 289e077957 Fix clog10 (-0 +/- 0i) (bug 16362).
This patch fixes the imaginary part of clog10 (-0 +/- 0i), which
should be +/-pi / log(10) by analogy with clog (the functions were
wrongly returning a result with imaginary part +/-pi, same as for
clog, and the tests matched the incorrect result, though both
functions and tests were correct for the similar case of clog10 (-inf
+/- 0i)).  Tested x86_64 and x86.

	[BZ #16362]
	* math/s_clog10.c (M_PI_LOG10E): New macro.
	(__clog10): Use M_PI_LOG10E instead of M_PI when real and
	imaginary parts are 0.
	* math/s_clog10f.c (M_PI_LOG10Ef): New macro.
	(__clog10f): Use M_PI_LOG10Ef instead of M_PI when real and
	imaginary parts are 0.
	* math/s_clog10l.c (M_PI_LOG10El): New macro.
	(__clog10l): Use M_PI_LOG10El instead of M_PIl when real and
	imaginary parts are 0.
	* math/libm-test.inc (clog10_test_data): Update expected results
	for when real and imaginary parts are 0.
2014-03-28 20:53:32 +00:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers d032e0d29b Fix inaccuracy of clog, clog10 near |z| = 1 (bug 13629). 2012-09-25 19:43:49 +00:00
Joseph Myers d0419dbfbd Improve clog, clog10 handling of values with real or imaginary part slightly above 1 (bug 13629). 2012-07-31 14:21:19 +00:00
Joseph Myers da865e95bc Improve clog, clog10 handling of values with real or imaginary part 1 (bug 13629). 2012-07-26 11:31:35 +00:00
Joseph Myers 638a572eb0 Fix clog, clog10 spurious underflow exceptions (bug 14337). 2012-07-09 11:06:34 +00:00
Joseph Myers 1897ad4432 Fix clog overflow/underflow (bug 13629). 2012-03-19 20:14:26 +00:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 77425c63e7 Add branch predictions to complex math code 2011-10-22 13:17:30 -04:00
Ulrich Drepper 9277c06437 Use private math_private.h in files in math/ 2011-10-08 05:16:04 -04:00
Ulrich Drepper 9d13fb2413 Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00