Changeset 1b20da0 in mainline for uspace/lib/c/generic/power_of_ten.c
- Timestamp:
- 2018-02-28T17:52:03Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/power_of_ten.c
rdf6ded8 r1b20da0 39 39 * 40 40 * The smallest interval of binary exponents computed by hand 41 * is [-1083, 987]. Add 200 (exponent change > 3 * 64 bits) 41 * is [-1083, 987]. Add 200 (exponent change > 3 * 64 bits) 42 42 * to both bounds just to be on the safe side; ie [-1283, 1187]. 43 43 */ … … 144 144 145 145 146 /** 147 * Returns the smallest precomputed power of 10 such that 146 /** 147 * Returns the smallest precomputed power of 10 such that 148 148 * binary_exp <= power_of_10.bin_exp 149 149 * where 150 * 10^decimal_exp = power_of_10.significand * 2^bin_exp 150 * 10^decimal_exp = power_of_10.significand * 2^bin_exp 151 151 * with an error of 0.5 ulp in the significand. 152 152 */ … … 160 160 assert(min_bin_exp <= binary_exp && binary_exp <= max_bin_exp); 161 161 162 /* 163 * Binary exponent difference between adjacent powers of 10 162 /* 163 * Binary exponent difference between adjacent powers of 10 164 164 * is lg(10^8) = 26.575. The starting search index seed_idx 165 165 * undershoots the actual position by less than 1.6%, ie it 166 166 * skips 26.575/27 = 98.4% of all the smaller powers. This 167 * translates to at most three extra tests. 167 * translates to at most three extra tests. 168 168 */ 169 169 int seed_idx = (binary_exp - min_bin_exp) / max_bin_exp_diff;
Note:
See TracChangeset
for help on using the changeset viewer.