s_atan.c (181074) | s_atan.c (218509) |
---|---|
1/* @(#)s_atan.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_atan.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_atan.c 181074 2008-07-31 22:41:26Z das $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_atan.c 218509 2011-02-10 07:37:50Z das $"); |
15 16/* atan(x) 17 * Method 18 * 1. Reduce x to positive by atan(x) = -atan(-x). 19 * 2. According to the integer k=4t+0.25 chopped, t=x, the argument 20 * is further reduced to one of the following intervals and the 21 * arctangent of t is evaluated by the corresponding formula: 22 * --- 59 unchanged lines hidden (view full) --- 82 u_int32_t low; 83 GET_LOW_WORD(low,x); 84 if(ix>0x7ff00000|| 85 (ix==0x7ff00000&&(low!=0))) 86 return x+x; /* NaN */ 87 if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3]; 88 else return -atanhi[3]-*(volatile double *)&atanlo[3]; 89 } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ | 15 16/* atan(x) 17 * Method 18 * 1. Reduce x to positive by atan(x) = -atan(-x). 19 * 2. According to the integer k=4t+0.25 chopped, t=x, the argument 20 * is further reduced to one of the following intervals and the 21 * arctangent of t is evaluated by the corresponding formula: 22 * --- 59 unchanged lines hidden (view full) --- 82 u_int32_t low; 83 GET_LOW_WORD(low,x); 84 if(ix>0x7ff00000|| 85 (ix==0x7ff00000&&(low!=0))) 86 return x+x; /* NaN */ 87 if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3]; 88 else return -atanhi[3]-*(volatile double *)&atanlo[3]; 89 } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ |
90 if (ix < 0x3e200000) { /* |x| < 2^-29 */ | 90 if (ix < 0x3e400000) { /* |x| < 2^-27 */ |
91 if(huge+x>one) return x; /* raise inexact */ 92 } 93 id = -1; 94 } else { 95 x = fabs(x); 96 if (ix < 0x3ff30000) { /* |x| < 1.1875 */ 97 if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ 98 id = 0; x = (2.0*x-one)/(2.0+x); --- 26 unchanged lines hidden --- | 91 if(huge+x>one) return x; /* raise inexact */ 92 } 93 id = -1; 94 } else { 95 x = fabs(x); 96 if (ix < 0x3ff30000) { /* |x| < 1.1875 */ 97 if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ 98 id = 0; x = (2.0*x-one)/(2.0+x); --- 26 unchanged lines hidden --- |