mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-10 19:30:10 +00:00
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.
This commit is contained in:
parent
277ae3f186
commit
289e077957
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2014-03-28 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
[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-27 Paul Pluzhnikov <ppluzhnikov@google.com>
|
2014-03-27 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||||
|
|
||||||
* elf/dl-load.c: Finish conversion of __builtin_expect into
|
* elf/dl-load.c: Finish conversion of __builtin_expect into
|
||||||
|
10
NEWS
10
NEWS
@ -9,11 +9,11 @@ Version 2.20
|
|||||||
|
|
||||||
* The following bugs are resolved with this release:
|
* The following bugs are resolved with this release:
|
||||||
|
|
||||||
15347, 15804, 15894, 16002, 16198, 16284, 16348, 16357, 16447, 16532,
|
15347, 15804, 15894, 16002, 16198, 16284, 16348, 16357, 16362, 16447,
|
||||||
16545, 16574, 16599, 16600, 16609, 16610, 16611, 16613, 16623, 16632,
|
16532, 16545, 16574, 16599, 16600, 16609, 16610, 16611, 16613, 16623,
|
||||||
16634, 16639, 16642, 16649, 16670, 16674, 16677, 16680, 16683, 16689,
|
16632, 16634, 16639, 16642, 16649, 16670, 16674, 16677, 16680, 16683,
|
||||||
16695, 16701, 16706, 16707, 16712, 16713, 16714, 16731, 16743, 16758,
|
16689, 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16731, 16743,
|
||||||
16759, 16760.
|
16758, 16759, 16760.
|
||||||
|
|
||||||
* Running the testsuite no longer terminates as soon as a test fails.
|
* Running the testsuite no longer terminates as soon as a test fails.
|
||||||
Instead, a file tests.sum (xtests.sum from "make xcheck") is generated,
|
Instead, a file tests.sum (xtests.sum from "make xcheck") is generated,
|
||||||
|
@ -6130,8 +6130,8 @@ clog_test (void)
|
|||||||
|
|
||||||
static const struct test_c_c_data clog10_test_data[] =
|
static const struct test_c_c_data clog10_test_data[] =
|
||||||
{
|
{
|
||||||
TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
|
TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PI_LOG10El, DIVIDE_BY_ZERO_EXCEPTION),
|
||||||
TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
|
TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PI_LOG10El, DIVIDE_BY_ZERO_EXCEPTION),
|
||||||
|
|
||||||
TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
|
TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
|
||||||
TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
|
TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
/* log_10 (2). */
|
/* log_10 (2). */
|
||||||
#define M_LOG10_2 0.3010299956639811952137388947244930267682
|
#define M_LOG10_2 0.3010299956639811952137388947244930267682
|
||||||
|
|
||||||
|
/* pi * log10 (e). */
|
||||||
|
#define M_PI_LOG10E 1.364376353841841347485783625431355770210
|
||||||
|
|
||||||
__complex__ double
|
__complex__ double
|
||||||
__clog10 (__complex__ double x)
|
__clog10 (__complex__ double x)
|
||||||
{
|
{
|
||||||
@ -35,7 +38,7 @@ __clog10 (__complex__ double x)
|
|||||||
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
||||||
{
|
{
|
||||||
/* Real and imaginary part are 0.0. */
|
/* Real and imaginary part are 0.0. */
|
||||||
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
|
__imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0;
|
||||||
__imag__ result = __copysign (__imag__ result, __imag__ x);
|
__imag__ result = __copysign (__imag__ result, __imag__ x);
|
||||||
/* Yes, the following line raises an exception. */
|
/* Yes, the following line raises an exception. */
|
||||||
__real__ result = -1.0 / fabs (__real__ x);
|
__real__ result = -1.0 / fabs (__real__ x);
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
/* log_10 (2). */
|
/* log_10 (2). */
|
||||||
#define M_LOG10_2f 0.3010299956639811952137388947244930267682f
|
#define M_LOG10_2f 0.3010299956639811952137388947244930267682f
|
||||||
|
|
||||||
|
/* pi * log10 (e). */
|
||||||
|
#define M_PI_LOG10Ef 1.364376353841841347485783625431355770210f
|
||||||
|
|
||||||
__complex__ float
|
__complex__ float
|
||||||
__clog10f (__complex__ float x)
|
__clog10f (__complex__ float x)
|
||||||
{
|
{
|
||||||
@ -35,7 +38,7 @@ __clog10f (__complex__ float x)
|
|||||||
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
||||||
{
|
{
|
||||||
/* Real and imaginary part are 0.0. */
|
/* Real and imaginary part are 0.0. */
|
||||||
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
|
__imag__ result = signbit (__real__ x) ? M_PI_LOG10Ef : 0.0;
|
||||||
__imag__ result = __copysignf (__imag__ result, __imag__ x);
|
__imag__ result = __copysignf (__imag__ result, __imag__ x);
|
||||||
/* Yes, the following line raises an exception. */
|
/* Yes, the following line raises an exception. */
|
||||||
__real__ result = -1.0 / fabsf (__real__ x);
|
__real__ result = -1.0 / fabsf (__real__ x);
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
/* log_10 (2). */
|
/* log_10 (2). */
|
||||||
#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
|
#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
|
||||||
|
|
||||||
|
/* pi * log10 (e). */
|
||||||
|
#define M_PI_LOG10El 1.364376353841841347485783625431355770210L
|
||||||
|
|
||||||
__complex__ long double
|
__complex__ long double
|
||||||
__clog10l (__complex__ long double x)
|
__clog10l (__complex__ long double x)
|
||||||
{
|
{
|
||||||
@ -42,7 +45,7 @@ __clog10l (__complex__ long double x)
|
|||||||
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
|
||||||
{
|
{
|
||||||
/* Real and imaginary part are 0.0. */
|
/* Real and imaginary part are 0.0. */
|
||||||
__imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
|
__imag__ result = signbit (__real__ x) ? M_PI_LOG10El : 0.0;
|
||||||
__imag__ result = __copysignl (__imag__ result, __imag__ x);
|
__imag__ result = __copysignl (__imag__ result, __imag__ x);
|
||||||
/* Yes, the following line raises an exception. */
|
/* Yes, the following line raises an exception. */
|
||||||
__real__ result = -1.0 / fabsl (__real__ x);
|
__real__ result = -1.0 / fabsl (__real__ x);
|
||||||
|
Loading…
Reference in New Issue
Block a user