Rev 828 | Rev 1031 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 828 | Rev 834 | ||
---|---|---|---|
Line 100... | Line 100... | ||
100 | frac2 <<= 6; |
100 | frac2 <<= 6; |
101 | 101 | ||
102 | if (expdiff < (FLOAT32_FRACTION_SIZE + 2) ) { |
102 | if (expdiff < (FLOAT32_FRACTION_SIZE + 2) ) { |
103 | frac2 >>= expdiff; |
103 | frac2 >>= expdiff; |
104 | frac1 += frac2; |
104 | frac1 += frac2; |
- | 105 | } else { |
|
- | 106 | a.parts.exp = exp1; |
|
- | 107 | a.parts.fraction = (frac1 >> 6) & (~(FLOAT32_HIDDEN_BIT_MASK)); |
|
- | 108 | return a; |
|
105 | }; |
109 | } |
106 | 110 | ||
107 | if (frac1 & (FLOAT32_HIDDEN_BIT_MASK << 7) ) { |
111 | if (frac1 & (FLOAT32_HIDDEN_BIT_MASK << 7) ) { |
108 | ++exp1; |
112 | ++exp1; |
109 | frac1 >>= 1; |
113 | frac1 >>= 1; |
110 | }; |
114 | }; |
Line 140... | Line 144... | ||
140 | { |
144 | { |
141 | int expdiff; |
145 | int expdiff; |
142 | __u32 exp1, exp2; |
146 | __u32 exp1, exp2; |
143 | __u64 frac1, frac2; |
147 | __u64 frac1, frac2; |
144 | 148 | ||
145 | expdiff = a.parts.exp - b.parts.exp; |
149 | expdiff = ((int )a.parts.exp) - b.parts.exp; |
146 | if (expdiff < 0) { |
150 | if (expdiff < 0) { |
147 | if (isFloat64NaN(b)) { |
151 | if (isFloat64NaN(b)) { |
148 | /* TODO: fix SigNaN */ |
152 | /* TODO: fix SigNaN */ |
149 | if (isFloat64SigNaN(b)) { |
153 | if (isFloat64SigNaN(b)) { |
150 | }; |
154 | }; |
Line 209... | Line 213... | ||
209 | frac2 <<= 6; |
213 | frac2 <<= 6; |
210 | 214 | ||
211 | if (expdiff < (FLOAT64_FRACTION_SIZE + 2) ) { |
215 | if (expdiff < (FLOAT64_FRACTION_SIZE + 2) ) { |
212 | frac2 >>= expdiff; |
216 | frac2 >>= expdiff; |
213 | frac1 += frac2; |
217 | frac1 += frac2; |
- | 218 | } else { |
|
- | 219 | a.parts.exp = exp1; |
|
- | 220 | a.parts.fraction = (frac1 >> 6) & (~(FLOAT64_HIDDEN_BIT_MASK)); |
|
- | 221 | return a; |
|
214 | }; |
222 | } |
215 | 223 | ||
216 | if (frac1 & (FLOAT64_HIDDEN_BIT_MASK << 7) ) { |
224 | if (frac1 & (FLOAT64_HIDDEN_BIT_MASK << 7) ) { |
217 | ++exp1; |
225 | ++exp1; |
218 | frac1 >>= 1; |
226 | frac1 >>= 1; |
219 | }; |
227 | }; |
Line 225... | Line 233... | ||
225 | /* rounding overflow */ |
233 | /* rounding overflow */ |
226 | ++exp1; |
234 | ++exp1; |
227 | frac1 >>= 1; |
235 | frac1 >>= 1; |
228 | }; |
236 | }; |
229 | 237 | ||
230 | if ((a.parts.exp == FLOAT64_MAX_EXPONENT ) || (a.parts.exp < exp1)) { |
238 | if ((exp1 == FLOAT64_MAX_EXPONENT ) || (exp2 > exp1)) { |
231 | /* overflow - set infinity as result */ |
239 | /* overflow - set infinity as result */ |
232 | a.parts.exp = FLOAT64_MAX_EXPONENT; |
240 | a.parts.exp = FLOAT64_MAX_EXPONENT; |
233 | a.parts.fraction = 0; |
241 | a.parts.fraction = 0; |
234 | return a; |
242 | return a; |
235 | } |
243 | } |
236 | 244 | ||
237 | a.parts.exp = exp1; |
245 | a.parts.exp = exp1; |
238 | /*Clear hidden bit and shift */ |
246 | /*Clear hidden bit and shift */ |
239 | a.parts.fraction = ( (frac1 >> 6 ) & (~FLOAT64_HIDDEN_BIT_MASK)); |
247 | a.parts.fraction = ( (frac1 >> 6 ) & (~FLOAT64_HIDDEN_BIT_MASK)); |
- | 248 | ||
240 | return a; |
249 | return a; |
241 | } |
250 | } |
242 | 251 | ||
243 | 252 |