mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-12 16:20:06 +00:00
Move mpone out to a global const
Code cleanup.
This commit is contained in:
parent
8ebac7785b
commit
b76eb5f076
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2012-12-27 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
|
||||
* sysdeps/ieee754/dbl-64/mpa.c [! NO__CONST]: New constant
|
||||
MPONE.
|
||||
* sysdeps/ieee754/dbl-64/mpa.h: Declare MPONE.
|
||||
* sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Remove local
|
||||
variable MPONE.
|
||||
* sysdeps/ieee754/dbl-64/mpatan2.c (__mpatan2): Likewise.
|
||||
* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Likewise.
|
||||
* sysdeps/ieee754/dbl-64/mplog.c (__mplog): Remove mplog.h
|
||||
include directive. Remove local variable MPONE.
|
||||
* sysdeps/ieee754/dbl-64/mplog.h: Remove.
|
||||
* sysdeps/x86_64/fpu/multiarch/mpa-avx.c: Define NO__CONST.
|
||||
* sysdeps/x86_64/fpu/multiarch/mpa-fma4.c: Likewise.
|
||||
|
||||
2012-12-25 David S. Miller <davem@davemloft.net>
|
||||
|
||||
* version.h (RELEASE): Set to "development".
|
||||
|
@ -51,6 +51,10 @@
|
||||
# define SECTION
|
||||
#endif
|
||||
|
||||
#ifndef NO__CONST
|
||||
const mp_no mpone = {1, {1.0, 1.0}};
|
||||
#endif
|
||||
|
||||
#ifndef NO___ACR
|
||||
/* mcr() compares the sizes of the mantissas of two multiple precision */
|
||||
/* numbers. Mantissas are compared regardless of the signs of the */
|
||||
|
@ -54,6 +54,8 @@ typedef struct {/* This structure holds the details of a multi-precision */
|
||||
|
||||
typedef union { int i[2]; double d; } number;
|
||||
|
||||
extern const mp_no mpone;
|
||||
|
||||
#define X x->d
|
||||
#define Y y->d
|
||||
#define Z z->d
|
||||
|
@ -48,9 +48,6 @@ __mpatan(mp_no *x, mp_no *y, int p) {
|
||||
int i,m,n;
|
||||
double dx;
|
||||
mp_no
|
||||
mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
|
||||
mptwo = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
|
||||
@ -60,7 +57,7 @@ __mpatan(mp_no *x, mp_no *y, int p) {
|
||||
|
||||
mp_no mps,mpsm,mpt,mpt1,mpt2,mpt3;
|
||||
|
||||
/* Choose m and initiate mpone, mptwo & mptwoim1 */
|
||||
/* Choose m and initiate mptwo & mptwoim1 */
|
||||
if (EX>0) m=7;
|
||||
else if (EX<0) m=0;
|
||||
else {
|
||||
@ -68,8 +65,8 @@ __mpatan(mp_no *x, mp_no *y, int p) {
|
||||
for (m=6; m>0; m--)
|
||||
{if (dx>__atan_xm[m].d) break;}
|
||||
}
|
||||
mpone.e = mptwo.e = mptwoim1.e = 1;
|
||||
mpone.d[0] = mpone.d[1] = mptwo.d[0] = mptwoim1.d[0] = ONE;
|
||||
mptwo.e = mptwoim1.e = 1;
|
||||
mptwo.d[0] = mptwoim1.d[0] = ONE;
|
||||
mptwo.d[1] = TWO;
|
||||
|
||||
/* Reduce x m times */
|
||||
|
@ -51,14 +51,10 @@ __mpatan2(mp_no *y, mp_no *x, mp_no *z, int p) {
|
||||
|
||||
static const double ZERO = 0.0, ONE = 1.0;
|
||||
|
||||
mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
|
||||
mp_no mpt1,mpt2,mpt3;
|
||||
|
||||
|
||||
if (X[0] <= ZERO) {
|
||||
mpone.e = 1; mpone.d[0] = mpone.d[1] = ONE;
|
||||
__dvd(x,y,&mpt1,p); __mul(&mpt1,&mpt1,&mpt2,p);
|
||||
if (mpt1.d[0] != ZERO) mpt1.d[0] = ONE;
|
||||
__add(&mpt2,&mpone,&mpt3,p); __mpsqrt(&mpt3,&mpt2,p);
|
||||
|
@ -56,9 +56,6 @@ __mpexp(mp_no *x, mp_no *y, int p) {
|
||||
{ 0, 0, 0, 0, 0, 0,23,28,33,38,42,47,52,57,62,66, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 0,39,43,47,51,55,59,63},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43,47,50,54}};
|
||||
mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
|
||||
mp_no mpk = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
|
||||
@ -84,7 +81,6 @@ __mpexp(mp_no *x, mp_no *y, int p) {
|
||||
__mul(x,&mpt1,&mps,p);
|
||||
|
||||
/* Evaluate the polynomial. Put result in mpt2 */
|
||||
mpone.e=1; mpone.d[0]=ONE; mpone.d[1]=ONE;
|
||||
mpk.e = 1; mpk.d[0] = ONE; mpk.d[1]=__mpexp_nn[n].d;
|
||||
__dvd(&mps,&mpk,&mpt1,p);
|
||||
__add(&mpone,&mpt1,&mpak,p);
|
||||
|
@ -40,21 +40,13 @@
|
||||
void __mpexp(mp_no *, mp_no *, int);
|
||||
|
||||
void __mplog(mp_no *x, mp_no *y, int p) {
|
||||
#include "mplog.h"
|
||||
int i,m;
|
||||
#if 0
|
||||
int j,k,m1,m2,n;
|
||||
double a,b;
|
||||
#endif
|
||||
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 mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
|
||||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
|
||||
mp_no mpt1,mpt2;
|
||||
|
||||
/* Choose m and initiate mpone */
|
||||
m = mp[p]; mpone.e = 1; mpone.d[0]=mpone.d[1]=ONE;
|
||||
/* 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). */
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* IBM Accurate Mathematical Library
|
||||
* Written by International Business Machines Corp.
|
||||
* Copyright (C) 2001 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.h */
|
||||
/* */
|
||||
/* common data and variables prototype and definition */
|
||||
/******************************************************************/
|
||||
|
||||
#ifndef MPLOG_H
|
||||
#define MPLOG_H
|
||||
|
||||
#ifdef BIG_ENDI
|
||||
static const number
|
||||
/**/ one = {{0x3ff00000, 0x00000000} }; /* 1 */
|
||||
|
||||
#else
|
||||
#ifdef LITTLE_ENDI
|
||||
static const number
|
||||
/**/ one = {{0x00000000, 0x3ff00000} }; /* 1 */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ONE one.d
|
||||
|
||||
#endif
|
@ -7,6 +7,7 @@
|
||||
#define NO___CPY 1
|
||||
#define NO___MP_DBL 1
|
||||
#define NO___ACR 1
|
||||
#define NO__CONST 1
|
||||
#define SECTION __attribute__ ((section (".text.avx")))
|
||||
|
||||
#include <sysdeps/ieee754/dbl-64/mpa.c>
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define NO___CPY 1
|
||||
#define NO___MP_DBL 1
|
||||
#define NO___ACR 1
|
||||
#define NO__CONST 1
|
||||
#define SECTION __attribute__ ((section (".text.fma4")))
|
||||
|
||||
#include <sysdeps/ieee754/dbl-64/mpa.c>
|
||||
|
Loading…
Reference in New Issue
Block a user