mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
107a5bf085
libm uses symbols mpone and mptwo for internal purposes. This patch moves them to the implementation namespace (__mpone and __mptwo). Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #17616] * sysdeps/ieee754/dbl-64/mpa.c (mpone): Rename to __mpone. (mptwo): Rename to __mptwo. (__inv): Use __mptwo instead of mptwo. * sysdeps/ieee754/dbl-64/mpa.h (mpone): Rename to __mpone. (mptwo): Rename to __mptwo. * sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Use __mpone instead of mpone and __mptwo instead of mptwo. * sysdeps/ieee754/dbl-64/mpatan2.c (__mpatan2): Use __mpone instead of mpone. * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Likewise. * sysdeps/ieee754/dbl-64/mplog.c (__mplog): Likewise. * sysdeps/ieee754/dbl-64/sincos32.c (__c32): Use __mpone instead of mpone and __mptwo instead of mptwo. (__mpranred): Use __mpone instead of mpone. * conform/Makefile (test-xfail-ISO/math.h/linknamespace): Remove variable. (test-xfail-ISO99/complex.h/linknamespace): Likewise. (test-xfail-ISO99/math.h/linknamespace): Likewise. (test-xfail-ISO99/tgmath.h/linknamespace): Likewise. (test-xfail-ISO11/complex.h/linknamespace): Likewise. (test-xfail-ISO11/math.h/linknamespace): Likewise. (test-xfail-ISO11/tgmath.h/linknamespace): Likewise. (test-xfail-XPG3/math.h/linknamespace): Likewise. (test-xfail-XPG4/math.h/linknamespace): Likewise. (test-xfail-POSIX/math.h/linknamespace): Likewise. (test-xfail-UNIX98/math.h/linknamespace): Likewise. (test-xfail-XOPEN2K/complex.h/linknamespace): Likewise. (test-xfail-XOPEN2K/math.h/linknamespace): Likewise. (test-xfail-XOPEN2K/tgmath.h/linknamespace): Likewise. (test-xfail-POSIX2008/complex.h/linknamespace): Likewise. (test-xfail-POSIX2008/math.h/linknamespace): Likewise. (test-xfail-POSIX2008/tgmath.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/complex.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/math.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/tgmath.h/linknamespace): Likewise.
66 lines
2.7 KiB
C
66 lines
2.7 KiB
C
/*
|
|
* IBM Accurate Mathematical Library
|
|
* written by International Business Machines Corp.
|
|
* Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation; either version 2.1 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
/************************************************************************/
|
|
/* */
|
|
/* MODULE_NAME:mplog.c */
|
|
/* */
|
|
/* FUNCTIONS: mplog */
|
|
/* */
|
|
/* FILES NEEDED: endian.h mpa.h mplog.h */
|
|
/* mpexp.c */
|
|
/* */
|
|
/* Multi-Precision logarithm function subroutine (for precision p >= 4, */
|
|
/* 2**(-1024) < x < 2**1024) and x is outside of the interval */
|
|
/* [1-2**(-54),1+2**(-54)]. Upon entry, x should be set to the */
|
|
/* multi-precision value of the input and y should be set into a multi- */
|
|
/* precision value of an approximation of log(x) with relative error */
|
|
/* bound of at most 2**(-52). The routine improves the accuracy of y. */
|
|
/* */
|
|
/************************************************************************/
|
|
#include "endian.h"
|
|
#include "mpa.h"
|
|
|
|
void
|
|
__mplog (mp_no *x, mp_no *y, int p)
|
|
{
|
|
int i, m;
|
|
static const int mp[33] =
|
|
{
|
|
0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
|
|
};
|
|
mp_no mpt1, mpt2;
|
|
|
|
/* Choose m. */
|
|
m = mp[p];
|
|
|
|
/* Perform m newton iterations to solve for y: exp(y) - x = 0. The
|
|
iterations formula is: y(n + 1) = y(n) + (x * exp(-y(n)) - 1). */
|
|
__cpy (y, &mpt1, p);
|
|
for (i = 0; i < m; i++)
|
|
{
|
|
mpt1.d[0] = -mpt1.d[0];
|
|
__mpexp (&mpt1, &mpt2, p);
|
|
__mul (x, &mpt2, &mpt1, p);
|
|
__sub (&mpt1, &__mpone, &mpt2, p);
|
|
__add (y, &mpt2, &mpt1, p);
|
|
__cpy (&mpt1, y, p);
|
|
}
|
|
}
|