Deleted Added
full compact
k_tan.c (108533) k_tan.c (129980)
1/* @(#)k_tan.c 5.1 93/09/24 */
2/*
3 * ====================================================
1/* @(#)k_tan.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
5 *
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
11 */
12
13#ifndef lint
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
8 * is preserved.
9 * ====================================================
10 */
11
12#ifndef lint
14static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tan.c 108533 2003-01-01 18:49:04Z schweikh $";
13static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tan.c 129980 2004-06-02 04:39:29Z das $";
15#endif
16
17/* __kernel_tan( x, y, k )
18 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
19 * Input x is assumed to be bounded by ~pi/4 in magnitude.
20 * Input y is the tail of x.
21 * Input k indicates whether tan (if k=1) or
22 * -1/tan (if k= -1) is returned.

--- 49 unchanged lines hidden (view full) ---

72
73double
74__kernel_tan(double x, double y, int iy)
75{
76 double z,r,v,w,s;
77 int32_t ix,hx;
78 GET_HIGH_WORD(hx,x);
79 ix = hx&0x7fffffff; /* high word of |x| */
14#endif
15
16/* __kernel_tan( x, y, k )
17 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
18 * Input x is assumed to be bounded by ~pi/4 in magnitude.
19 * Input y is the tail of x.
20 * Input k indicates whether tan (if k=1) or
21 * -1/tan (if k= -1) is returned.

--- 49 unchanged lines hidden (view full) ---

71
72double
73__kernel_tan(double x, double y, int iy)
74{
75 double z,r,v,w,s;
76 int32_t ix,hx;
77 GET_HIGH_WORD(hx,x);
78 ix = hx&0x7fffffff; /* high word of |x| */
80 if(ix<0x3e300000) /* x < 2**-28 */
81 {if((int)x==0) { /* generate inexact */
82 u_int32_t low;
83 GET_LOW_WORD(low,x);
84 if(((ix|low)|(iy+1))==0) return one/fabs(x);
85 else return (iy==1)? x: -one/x;
86 }
87 }
79 if(ix<0x3e300000) { /* x < 2**-28 */
80 if ((int) x == 0) { /* generate inexact */
81 u_int32_t low;
82 GET_LOW_WORD(low,x);
83 if (((ix | low) | (iy + 1)) == 0)
84 return one / fabs(x);
85 else {
86 if (iy == 1)
87 return x;
88 else { /* compute -1 / (x+y) carefully */
89 double a, t;
90
91 z = w = x + y;
92 SET_LOW_WORD(z, 0);
93 v = y - (z - x);
94 t = a = -one / w;
95 SET_LOW_WORD(t, 0);
96 s = one + t * z;
97 return t + a * (s + t * v);
98 }
99 }
100 }
101 }
88 if(ix>=0x3FE59428) { /* |x|>=0.6744 */
89 if(hx<0) {x = -x; y = -y;}
90 z = pio4-x;
91 w = pio4lo-y;
92 x = z+w; y = 0.0;
93 }
94 z = x*x;
95 w = z*z;

--- 28 unchanged lines hidden ---
102 if(ix>=0x3FE59428) { /* |x|>=0.6744 */
103 if(hx<0) {x = -x; y = -y;}
104 z = pio4-x;
105 w = pio4lo-y;
106 x = z+w; y = 0.0;
107 }
108 z = x*x;
109 w = z*z;

--- 28 unchanged lines hidden ---