glibc/sysdeps/ieee754/dbl-64/slowexp.c
Ulrich Drepper ca58f1dbeb Update.
2001-03-12  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/ieee754/dbl-64/e_remainder.c: Fix handling of boundary
	conditions.

	* sysdeps/ieee754/dbl-64/e_pow.c: Fix handling of boundary
	conditions.

	* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Handle Inf and NaN
	correctly.
	(__cos): Likewise.

	* sysdeps/ieee754/dbl-64/e_asin.c (__ieee754_asin): Handle NaN
	correctly.
	(__ieee754_acos): Likewise.

	redefinition.
	* sysdeps/ieee754/dbl-64/endian.h: Define also one of BIG_ENDI and
	LITTLE_ENDI.

	* sysdeps/ieee754/dbl-64/MathLib.h (Init_Lib): Use void as
	parameter list.
2001-03-13 02:01:34 +00:00

66 lines
2.5 KiB
C

/*
* IBM Accurate Mathematical Library
* Copyright (c) International Business Machines Corp., 2001
*
* 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 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 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**************************************************************************/
/* MODULE_NAME:slowexp.c */
/* */
/* FUNCTION:slowexp */
/* */
/* FILES NEEDED:mpa.h */
/* mpa.c mpexp.c */
/* */
/*Converting from double precision to Multi-precision and calculating */
/* e^x */
/**************************************************************************/
#include "mpa.h"
void __mpexp(mp_no *x, mp_no *y, int p);
/*Converting from double precision to Multi-precision and calculating e^x */
double __slowexp(double x) {
double w,z,res,eps=3.0e-26;
#if 0
double y;
#endif
int p;
#if 0
int orig,i;
#endif
mp_no mpx, mpy, mpz,mpw,mpeps,mpcor;
p=6;
__dbl_mp(x,&mpx,p); /* Convert a double precision number x */
/* into a multiple precision number mpx with prec. p. */
__mpexp(&mpx, &mpy, p); /* Multi-Precision exponential function */
__dbl_mp(eps,&mpeps,p);
__mul(&mpeps,&mpy,&mpcor,p);
__add(&mpy,&mpcor,&mpw,p);
__sub(&mpy,&mpcor,&mpz,p);
__mp_dbl(&mpw, &w, p);
__mp_dbl(&mpz, &z, p);
if (w == z) return w;
else { /* if calculating is not exactly */
p = 32;
__dbl_mp(x,&mpx,p);
__mpexp(&mpx, &mpy, p);
__mp_dbl(&mpy, &res, p);
return res;
}
}