Changeset e979fea in mainline for softfloat/generic/div.c
- Timestamp:
- 2006-02-10T13:43:41Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d3ca210
- Parents:
- e6a40ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
softfloat/generic/div.c
re6a40ac re979fea 32 32 #include<comparison.h> 33 33 #include<mul.h> 34 #include<common.h> 35 34 36 35 37 float32 divFloat32(float32 a, float32 b) … … 307 309 } 308 310 309 /* pack and round */ 310 311 /* find first nonzero digit and shift result and detect possibly underflow */ 312 while ((cexp > 0) && (cfrac) && (!(cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1 ) )))) { 313 cexp--; 314 cfrac <<= 1; 315 /* TODO: fix underflow */ 316 }; 317 318 319 cfrac >>= 1; 320 ++cexp; 321 cfrac += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3)); 322 323 if (cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1 ))) { 324 ++cexp; 325 cfrac >>= 1; 326 } 327 328 /* check overflow */ 329 if (cexp >= FLOAT64_MAX_EXPONENT ) { 330 /* FIXME: overflow, return infinity */ 331 result.parts.exp = FLOAT64_MAX_EXPONENT; 332 result.parts.fraction = 0; 333 return result; 334 } 335 336 if (cexp < 0) { 337 /* FIXME: underflow */ 338 result.parts.exp = 0; 339 if ((cexp + FLOAT64_FRACTION_SIZE) < 0) { 340 result.parts.fraction = 0; 341 return result; 342 } 343 cfrac >>= 1; 344 while (cexp < 0) { 345 cexp ++; 346 cfrac >>= 1; 347 } 348 return result; 349 350 } else { 351 cexp ++; /*normalized*/ 352 result.parts.exp = (__u32)cexp; 353 } 354 355 result.parts.fraction = ((cfrac >>(64 - FLOAT64_FRACTION_SIZE - 2 ) ) & (~FLOAT64_HIDDEN_BIT_MASK)); 356 357 return result; 311 /* round and shift */ 312 result = finishFloat64(cexp, cfrac, result.parts.sign); 313 return result; 314 358 315 } 359 316
Note:
See TracChangeset
for help on using the changeset viewer.