Deleted Added
full compact
s_tan.c (117912) s_tan.c (151969)
1/* @(#)s_tan.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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
1/* @(#)s_tan.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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
14static char rcsid[] = "$FreeBSD: head/lib/msun/src/s_tan.c 117912 2003-07-23 04:53:47Z peter $";
14static char rcsid[] = "$FreeBSD: head/lib/msun/src/s_tan.c 151969 2005-11-02 14:01:45Z bde $";
15#endif
16
17/* tan(x)
18 * Return tangent function of x.
19 *
20 * kernel function:
21 * __kernel_tan ... tangent function on [-pi/4,pi/4]
22 * __ieee754_rem_pio2 ... argument reduction routine

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

53 double y[2],z=0.0;
54 int32_t n, ix;
55
56 /* High word of x. */
57 GET_HIGH_WORD(ix,x);
58
59 /* |x| ~< pi/4 */
60 ix &= 0x7fffffff;
15#endif
16
17/* tan(x)
18 * Return tangent function of x.
19 *
20 * kernel function:
21 * __kernel_tan ... tangent function on [-pi/4,pi/4]
22 * __ieee754_rem_pio2 ... argument reduction routine

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

53 double y[2],z=0.0;
54 int32_t n, ix;
55
56 /* High word of x. */
57 GET_HIGH_WORD(ix,x);
58
59 /* |x| ~< pi/4 */
60 ix &= 0x7fffffff;
61 if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
61 if(ix <= 0x3fe921fb) {
62 if(ix<0x3e300000) /* x < 2**-28 */
63 if((int)x==0) return x; /* generate inexact */
64 return __kernel_tan(x,z,1);
65 }
62
63 /* tan(Inf or NaN) is NaN */
64 else if (ix>=0x7ff00000) return x-x; /* NaN */
65
66 /* argument reduction needed */
67 else {
68 n = __ieee754_rem_pio2(x,y);
69 return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
70 -1 -- n odd */
71 }
72}
66
67 /* tan(Inf or NaN) is NaN */
68 else if (ix>=0x7ff00000) return x-x; /* NaN */
69
70 /* argument reduction needed */
71 else {
72 n = __ieee754_rem_pio2(x,y);
73 return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
74 -1 -- n odd */
75 }
76}