Format slowexp.c

This commit is contained in:
Siddhesh Poyarekar 2013-02-25 16:13:35 +05:30
parent 8930ddc705
commit 2f22a1e8dd
2 changed files with 29 additions and 22 deletions

View File

@ -1,5 +1,8 @@
2013-02-25 Siddhesh Poyarekar <siddhesh@redhat.com> 2013-02-25 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/ieee754/dbl-64/slowexp.c: Reformat in GNU coding
style.
* sysdeps/ieee754/dbl-64/slowpow.c: Reformat in GNU coding * sysdeps/ieee754/dbl-64/slowpow.c: Reformat in GNU coding
style. style.

View File

@ -34,32 +34,36 @@
# define SECTION # define SECTION
#endif #endif
void __mpexp(mp_no *x, mp_no *y, int p); void __mpexp (mp_no *x, mp_no *y, int p);
/*Converting from double precision to Multi-precision and calculating e^x */ /*Converting from double precision to Multi-precision and calculating e^x */
double double
SECTION SECTION
__slowexp(double x) { __slowexp (double x)
double w,z,res,eps=3.0e-26; {
double w, z, res, eps = 3.0e-26;
int p; int p;
mp_no mpx, mpy, mpz,mpw,mpeps,mpcor; mp_no mpx, mpy, mpz, mpw, mpeps, mpcor;
p=6; /* Use the multiple precision __MPEXP function to compute the exponential
__dbl_mp(x,&mpx,p); /* Convert a double precision number x */ First at 144 bits and if it is not accurate enough, at 768 bits. */
/* into a multiple precision number mpx with prec. p. */ p = 6;
__mpexp(&mpx, &mpy, p); /* Multi-Precision exponential function */ __dbl_mp (x, &mpx, p);
__dbl_mp(eps,&mpeps,p); __mpexp (&mpx, &mpy, p);
__mul(&mpeps,&mpy,&mpcor,p); __dbl_mp (eps, &mpeps, p);
__add(&mpy,&mpcor,&mpw,p); __mul (&mpeps, &mpy, &mpcor, p);
__sub(&mpy,&mpcor,&mpz,p); __add (&mpy, &mpcor, &mpw, p);
__mp_dbl(&mpw, &w, p); __sub (&mpy, &mpcor, &mpz, p);
__mp_dbl(&mpz, &z, p); __mp_dbl (&mpw, &w, p);
if (w == z) return w; __mp_dbl (&mpz, &z, p);
else { /* if calculating is not exactly */ if (w == z)
p = 32; return w;
__dbl_mp(x,&mpx,p); else
__mpexp(&mpx, &mpy, p); {
__mp_dbl(&mpy, &res, p); p = 32;
return res; __dbl_mp (x, &mpx, p);
} __mpexp (&mpx, &mpy, p);
__mp_dbl (&mpy, &res, p);
return res;
}
} }