Changeset 7c3fb9b in mainline for uspace/lib/c/generic/double_to_str.c
- Timestamp:
- 2018-05-17T08:29:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ff23ff
- Parents:
- fac0ac7
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-16 17:28:17)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-17 08:29:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/double_to_str.c
rfac0ac7 r7c3fb9b 102 102 ac = a * c; 103 103 104 /* Denote 32 bit parts of x a y as: x == a b, y == c d. Then: 104 /* 105 * Denote 32 bit parts of x a y as: x == a b, y == c d. Then: 105 106 * a b 106 107 * * c d … … 280 281 (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest); 281 282 282 /* Of the shortest strings pick the one that is closest to the actual 283 floating point number. */ 283 /* 284 * Of the shortest strings pick the one that is closest to the actual 285 * floating point number. 286 */ 284 287 while (next_closer) { 285 288 assert('0' < buf[len - 1]); … … 571 574 * |0 0 .. 0 1|0 0 .. 0 0| == one == 1.0 572 575 * | 0 |0 0 .. 0 1| == w_err == 1 * 2^w_scaled.e 573 */576 */ 574 577 assert(alpha <= w_scaled.exponent && w_scaled.exponent <= gamma); 575 578 assert(0 != w_scaled.significand); … … 589 592 one.exponent = w_scaled.exponent; 590 593 591 /* Extract the integral part of w_scaled. 592 w_scaled / one == w_scaled >> -one.e */ 594 /* 595 * Extract the integral part of w_scaled. 596 * w_scaled / one == w_scaled >> -one.e 597 */ 593 598 uint32_t int_part = (uint32_t)(w_scaled.significand >> (-one.exponent)); 594 599 595 /* Fractional part of w_scaled. 596 w_scaled % one == w_scaled & (one.f - 1) */ 600 /* 601 * Fractional part of w_scaled. 602 * w_scaled % one == w_scaled & (one.f - 1) 603 */ 597 604 uint64_t frac_part = w_scaled.significand & (one.significand - 1); 598 605
Note:
See TracChangeset
for help on using the changeset viewer.