comparison src/video/e_log.h @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
83 Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ 83 Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
84 Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ 84 Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
85 85
86 #ifdef __STDC__ 86 #ifdef __STDC__
87 double 87 double
88 __ieee754_log (double x) 88 __ieee754_log(double x)
89 #else 89 #else
90 double 90 double
91 __ieee754_log (x) 91 __ieee754_log(x)
92 double x; 92 double x;
93 #endif 93 #endif
94 { 94 {
95 double hfsq, f, s, z, R, w, t1, t2, dk; 95 double hfsq, f, s, z, R, w, t1, t2, dk;
96 int32_t k, hx, i, j; 96 int32_t k, hx, i, j;
97 u_int32_t lx; 97 u_int32_t lx;
98 98
99 EXTRACT_WORDS (hx, lx, x); 99 EXTRACT_WORDS(hx, lx, x);
100 100
101 k = 0; 101 k = 0;
102 if (hx < 0x00100000) { /* x < 2**-1022 */ 102 if (hx < 0x00100000) { /* x < 2**-1022 */
103 if (((hx & 0x7fffffff) | lx) == 0) 103 if (((hx & 0x7fffffff) | lx) == 0)
104 return -two54 / zero; /* log(+-0)=-inf */ 104 return -two54 / zero; /* log(+-0)=-inf */
105 if (hx < 0) 105 if (hx < 0)
106 return (x - x) / zero; /* log(-#) = NaN */ 106 return (x - x) / zero; /* log(-#) = NaN */
107 k -= 54; 107 k -= 54;
108 x *= two54; /* subnormal number, scale up x */ 108 x *= two54; /* subnormal number, scale up x */
109 GET_HIGH_WORD (hx, x); 109 GET_HIGH_WORD(hx, x);
110 } 110 }
111 if (hx >= 0x7ff00000) 111 if (hx >= 0x7ff00000)
112 return x + x; 112 return x + x;
113 k += (hx >> 20) - 1023; 113 k += (hx >> 20) - 1023;
114 hx &= 0x000fffff; 114 hx &= 0x000fffff;
115 i = (hx + 0x95f64) & 0x100000; 115 i = (hx + 0x95f64) & 0x100000;
116 SET_HIGH_WORD (x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */ 116 SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */
117 k += (i >> 20); 117 k += (i >> 20);
118 f = x - 1.0; 118 f = x - 1.0;
119 if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */ 119 if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */
120 if (f == zero) { 120 if (f == zero) {
121 if (k == 0) 121 if (k == 0)