k_tan.c (141296) | k_tan.c (151963) |
---|---|
1/* @(#)k_tan.c 1.5 04/04/22 SMI */ 2 3/* 4 * ==================================================== 5 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. 6 * 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/* INDENT OFF */ 14#ifndef lint | 1/* @(#)k_tan.c 1.5 04/04/22 SMI */ 2 3/* 4 * ==================================================== 5 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. 6 * 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/* INDENT OFF */ 14#ifndef lint |
15static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tan.c 141296 2005-02-04 18:26:06Z das $"; | 15static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tan.c 151963 2005-11-02 06:45:21Z bde $"; |
16#endif 17 18/* __kernel_tan( x, y, k ) 19 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 20 * Input x is assumed to be bounded by ~pi/4 in magnitude. 21 * Input y is the tail of x. 22 * Input k indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned. 23 * --- 56 unchanged lines hidden (view full) --- 80 int32_t ix, hx; 81 82 GET_HIGH_WORD(hx,x); 83 ix = hx & 0x7fffffff; /* high word of |x| */ 84 if (ix < 0x3e300000) { /* x < 2**-28 */ 85 if ((int) x == 0) { /* generate inexact */ 86 u_int32_t low; 87 GET_LOW_WORD(low,x); | 16#endif 17 18/* __kernel_tan( x, y, k ) 19 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 20 * Input x is assumed to be bounded by ~pi/4 in magnitude. 21 * Input y is the tail of x. 22 * Input k indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned. 23 * --- 56 unchanged lines hidden (view full) --- 80 int32_t ix, hx; 81 82 GET_HIGH_WORD(hx,x); 83 ix = hx & 0x7fffffff; /* high word of |x| */ 84 if (ix < 0x3e300000) { /* x < 2**-28 */ 85 if ((int) x == 0) { /* generate inexact */ 86 u_int32_t low; 87 GET_LOW_WORD(low,x); |
88 if (((ix | low) | (iy + 1)) == 0) 89 return one / fabs(x); 90 else { | 88 { |
91 if (iy == 1) 92 return x; 93 else { /* compute -1 / (x+y) carefully */ 94 double a, t; 95 96 z = w = x + y; 97 SET_LOW_WORD(z, 0); 98 v = y - (z - x); --- 56 unchanged lines hidden --- | 89 if (iy == 1) 90 return x; 91 else { /* compute -1 / (x+y) carefully */ 92 double a, t; 93 94 z = w = x + y; 95 SET_LOW_WORD(z, 0); 96 v = y - (z - x); --- 56 unchanged lines hidden --- |