s_tan.c (38662c9698c40b6b5adf72db4c3c0c4f5d62f6a0) s_tan.c (e044d80d08bf0eca40f938c05dd34a951f4a0814)
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

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

57 int32_t n, ix;
58
59 /* High word of x. */
60 GET_HIGH_WORD(ix,x);
61
62 /* |x| ~< pi/4 */
63 ix &= 0x7fffffff;
64 if(ix <= 0x3fe921fb) {
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

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

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