s_tan.c (176385) | s_tan.c (218509) |
---|---|
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#include <sys/cdefs.h> | 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#include <sys/cdefs.h> |
14__FBSDID("$FreeBSD: head/lib/msun/src/s_tan.c 176385 2008-02-18 14:02:12Z bde $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_tan.c 218509 2011-02-10 07:37:50Z das $"); |
15 16/* tan(x) 17 * Return tangent function of x. 18 * 19 * kernel function: 20 * __kernel_tan ... tangent function on [-pi/4,pi/4] 21 * __ieee754_rem_pio2 ... argument reduction routine 22 * --- 34 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) { | 15 16/* tan(x) 17 * Return tangent function of x. 18 * 19 * kernel function: 20 * __kernel_tan ... tangent function on [-pi/4,pi/4] 21 * __ieee754_rem_pio2 ... argument reduction routine 22 * --- 34 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 |