s_atan.c (176451) | s_atan.c (181062) |
---|---|
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 176451 2008-02-22 02:30:36Z das $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_atan.c 181062 2008-07-31 19:57: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 * --- 54 unchanged lines hidden (view full) --- 77 GET_HIGH_WORD(hx,x); 78 ix = hx&0x7fffffff; 79 if(ix>=0x44100000) { /* if |x| >= 2^66 */ 80 u_int32_t low; 81 GET_LOW_WORD(low,x); 82 if(ix>0x7ff00000|| 83 (ix==0x7ff00000&&(low!=0))) 84 return x+x; /* NaN */ | 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 * --- 54 unchanged lines hidden (view full) --- 77 GET_HIGH_WORD(hx,x); 78 ix = hx&0x7fffffff; 79 if(ix>=0x44100000) { /* if |x| >= 2^66 */ 80 u_int32_t low; 81 GET_LOW_WORD(low,x); 82 if(ix>0x7ff00000|| 83 (ix==0x7ff00000&&(low!=0))) 84 return x+x; /* NaN */ |
85 if(hx>0) return atanhi[3]+atanlo[3]; 86 else return -atanhi[3]-atanlo[3]; | 85 if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3]; 86 else return -atanhi[3]-*(volatile double *)&atanlo[3]; |
87 } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ 88 if (ix < 0x3e200000) { /* |x| < 2^-29 */ 89 if(huge+x>one) return x; /* raise inexact */ 90 } 91 id = -1; 92 } else { 93 x = fabs(x); 94 if (ix < 0x3ff30000) { /* |x| < 1.1875 */ --- 24 unchanged lines hidden --- | 87 } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ 88 if (ix < 0x3e200000) { /* |x| < 2^-29 */ 89 if(huge+x>one) return x; /* raise inexact */ 90 } 91 id = -1; 92 } else { 93 x = fabs(x); 94 if (ix < 0x3ff30000) { /* |x| < 1.1875 */ --- 24 unchanged lines hidden --- |