summaryrefslogtreecommitdiffstats
path: root/lib/msun/src/k_tanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/msun/src/k_tanf.c')
-rw-r--r--lib/msun/src/k_tanf.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/msun/src/k_tanf.c b/lib/msun/src/k_tanf.c
index cc498d5..77bc7b71 100644
--- a/lib/msun/src/k_tanf.c
+++ b/lib/msun/src/k_tanf.c
@@ -21,35 +21,32 @@ static char rcsid[] = "$FreeBSD$";
#include "math.h"
#include "math_private.h"
-static const float
-pio4 = 7.8539812565e-01, /* 0x3f490fda */
-pio4lo= 3.7748947079e-08, /* 0x33222168 */
-/* |tan(x)/x - t(x)| < 2**-29.2 (~[-1.73e-09, 1.724e-09]). */
+static const double
+pio4 = M_PI_4,
+/* |tan(x)/x - t(x)| < 2**-29.1 (~[-1.72e-09, 1.719e-09]). */
T[] = {
- 0xaaaaa3.0p-25, /* 0.33333310485 */
- 0x888b06.0p-26, /* 0.13334283238 */
- 0xdc84c8.0p-28, /* 0.053837567568 */
- 0xb9d8f1.0p-29, /* 0.022686453536 */
- 0xcfe632.0p-31, /* 0.0063445800915 */
- 0xeaf97e.0p-31, /* 0.0071708550677 */
+ 0x1555545f8b54d0.0p-54, /* 0.333333104424423432022 */
+ 0x111160cdc2c9af.0p-55, /* 0.133342838734802765499 */
+ 0x1b9097e5693cd0.0p-57, /* 0.0538375346701457369036 */
+ 0x173b2333895b6f.0p-58, /* 0.0226865291791357691353 */
+ 0x19fcb197e825ab.0p-60, /* 0.00634450313965243938713 */
+ 0x1d5f3701b44a27.0p-60, /* 0.00717088210082520490646 */
};
#ifdef INLINE_KERNEL_TANF
extern inline
#endif
float
-__kernel_tanf(float x, float y, int iy)
+__kernel_tandf(double x, int iy)
{
- float z,r,v,w,s;
+ double z,r,v,w,s;
int32_t ix,hx;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x3f2ca140) { /* |x|>=0.67434 */
- if(hx<0) {x = -x; y = -y;}
- z = pio4-x;
- w = pio4lo-y;
- x = z+w; y = 0.0;
+ if(hx<0) {x = -x;}
+ x = pio4-x;
}
z = x*x;
w = z*z;
@@ -60,13 +57,13 @@ __kernel_tanf(float x, float y, int iy)
r = T[1]+w*(T[3]+w*T[5]);
v = z*(T[2]+w*T[4]);
s = z*x;
- r = y + z*(s*(r+v)+y);
+ r = z*s*(r+v);
r += T[0]*s;
w = x+r;
if(ix>=0x3f2ca140) {
- v = (float)iy;
- return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r)));
+ v = (double)iy;
+ return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
}
if(iy==1) return w;
- else return -1.0/((double)x+r);
+ else return -1.0/w;
}
OpenPOWER on IntegriCloud