Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | static char *_qdtoa( volatile double d, int mode, int ndigits, int *decpt, | - |
9 | int *sign, char **rve, char **digits_str); | - |
10 | | - |
11 | | - |
12 | QString qulltoa(qulonglong l, int base, const QChar _zero) | - |
13 | { | - |
14 | ushort buff[65]; | - |
15 | ushort *p = buff + 65; | - |
16 | | - |
17 | if (base != 10 || _zero.unicode() == '0') { evaluated: base != 10 yes Evaluation Count:17830 | yes Evaluation Count:12274871 |
partially evaluated: _zero.unicode() == '0' yes Evaluation Count:12274873 | no Evaluation Count:0 |
| 0-12274873 |
18 | while (l != 0) { evaluated: l != 0 yes Evaluation Count:21890873 | yes Evaluation Count:12292692 |
| 12292692-21890873 |
19 | int c = l % base; | - |
20 | | - |
21 | --p; | - |
22 | | - |
23 | if (c < 10) evaluated: c < 10 yes Evaluation Count:21861624 | yes Evaluation Count:29248 |
| 29248-21861624 |
24 | *p = '0' + c; executed: *p = '0' + c; Execution Count:21861622 | 21861622 |
25 | else | - |
26 | *p = c - 10 + 'a'; executed: *p = c - 10 + 'a'; Execution Count:29248 | 29248 |
27 | | - |
28 | l /= base; | - |
29 | } executed: } Execution Count:21890872 | 21890872 |
30 | } executed: } Execution Count:12292693 | 12292693 |
31 | else { | - |
32 | while (l != 0) { | 0 |
33 | int c = l % base; | - |
34 | | - |
35 | *(--p) = _zero.unicode() + c; | - |
36 | | - |
37 | l /= base; | - |
38 | } | 0 |
39 | } | 0 |
40 | | - |
41 | return QString(reinterpret_cast<QChar *>(p), 65 - (p - buff)); executed: return QString(reinterpret_cast<QChar *>(p), 65 - (p - buff)); Execution Count:12292693 | 12292693 |
42 | } | - |
43 | | - |
44 | QString qlltoa(qlonglong l, int base, const QChar zero) | - |
45 | { | - |
46 | return qulltoa(l < 0 ? -l : l, base, zero); executed: return qulltoa(l < 0 ? -l : l, base, zero); Execution Count:12249825 | 12249825 |
47 | } | - |
48 | | - |
49 | QString &decimalForm(QChar zero, QChar decimal, QChar group, | - |
50 | QString &digits, int decpt, uint precision, | - |
51 | PrecisionMode pm, | - |
52 | bool always_show_decpt, | - |
53 | bool thousands_group) | - |
54 | { | - |
55 | if (decpt < 0) { evaluated: decpt < 0 yes Evaluation Count:18517 | yes Evaluation Count:1418491 |
| 18517-1418491 |
56 | for (int i = 0; i < -decpt; ++i) evaluated: i < -decpt yes Evaluation Count:46371 | yes Evaluation Count:18517 |
| 18517-46371 |
57 | digits.prepend(zero); executed: digits.prepend(zero); Execution Count:46371 | 46371 |
58 | decpt = 0; | - |
59 | } executed: } Execution Count:18517 | 18517 |
60 | else if (decpt > digits.length()) { evaluated: decpt > digits.length() yes Evaluation Count:378781 | yes Evaluation Count:1039710 |
| 378781-1039710 |
61 | for (int i = digits.length(); i < decpt; ++i) evaluated: i < decpt yes Evaluation Count:522776 | yes Evaluation Count:378781 |
| 378781-522776 |
62 | digits.append(zero); executed: digits.append(zero); Execution Count:522776 | 522776 |
63 | } executed: } Execution Count:378781 | 378781 |
64 | | - |
65 | if (pm == PMDecimalDigits) { evaluated: pm == PMDecimalDigits yes Evaluation Count:1629 | yes Evaluation Count:1435379 |
| 1629-1435379 |
66 | uint decimal_digits = digits.length() - decpt; | - |
67 | for (uint i = decimal_digits; i < precision; ++i) evaluated: i < precision yes Evaluation Count:7031 | yes Evaluation Count:1629 |
| 1629-7031 |
68 | digits.append(zero); executed: digits.append(zero); Execution Count:7031 | 7031 |
69 | } executed: } Execution Count:1629 | 1629 |
70 | else if (pm == PMSignificantDigits) { evaluated: pm == PMSignificantDigits yes Evaluation Count:2386 | yes Evaluation Count:1432993 |
| 2386-1432993 |
71 | for (uint i = digits.length(); i < precision; ++i) evaluated: i < precision yes Evaluation Count:7938 | yes Evaluation Count:2386 |
| 2386-7938 |
72 | digits.append(zero); executed: digits.append(zero); Execution Count:7938 | 7938 |
73 | } executed: } Execution Count:2386 | 2386 |
74 | else { | - |
75 | } executed: } Execution Count:1432993 | 1432993 |
76 | | - |
77 | if (always_show_decpt || decpt < digits.length()) evaluated: always_show_decpt yes Evaluation Count:2388 | yes Evaluation Count:1434620 |
evaluated: decpt < digits.length() yes Evaluation Count:51264 | yes Evaluation Count:1383356 |
| 2388-1434620 |
78 | digits.insert(decpt, decimal); executed: digits.insert(decpt, decimal); Execution Count:53652 | 53652 |
79 | | - |
80 | if (thousands_group) { evaluated: thousands_group yes Evaluation Count:5756 | yes Evaluation Count:1431252 |
| 5756-1431252 |
81 | for (int i = decpt - 3; i > 0; i -= 3) evaluated: i > 0 yes Evaluation Count:2737 | yes Evaluation Count:5756 |
| 2737-5756 |
82 | digits.insert(i, group); executed: digits.insert(i, group); Execution Count:2737 | 2737 |
83 | } executed: } Execution Count:5756 | 5756 |
84 | | - |
85 | if (decpt == 0) evaluated: decpt == 0 yes Evaluation Count:47367 | yes Evaluation Count:1389641 |
| 47367-1389641 |
86 | digits.prepend(zero); executed: digits.prepend(zero); Execution Count:47367 | 47367 |
87 | | - |
88 | return digits; executed: return digits; Execution Count:1437008 | 1437008 |
89 | } | - |
90 | | - |
91 | QString &exponentForm(QChar zero, QChar decimal, QChar exponential, | - |
92 | QChar group, QChar plus, QChar minus, | - |
93 | QString &digits, int decpt, uint precision, | - |
94 | PrecisionMode pm, | - |
95 | bool always_show_decpt) | - |
96 | { | - |
97 | int exp = decpt - 1; | - |
98 | | - |
99 | if (pm == PMDecimalDigits) { evaluated: pm == PMDecimalDigits yes Evaluation Count:11 | yes Evaluation Count:68259 |
| 11-68259 |
100 | for (uint i = digits.length(); i < precision + 1; ++i) evaluated: i < precision + 1 yes Evaluation Count:14 | yes Evaluation Count:11 |
| 11-14 |
101 | digits.append(zero); executed: digits.append(zero); Execution Count:14 | 14 |
102 | } executed: } Execution Count:11 | 11 |
103 | else if (pm == PMSignificantDigits) { evaluated: pm == PMSignificantDigits yes Evaluation Count:2224 | yes Evaluation Count:66035 |
| 2224-66035 |
104 | for (uint i = digits.length(); i < precision; ++i) evaluated: i < precision yes Evaluation Count:1920 | yes Evaluation Count:2224 |
| 1920-2224 |
105 | digits.append(zero); executed: digits.append(zero); Execution Count:1920 | 1920 |
106 | } executed: } Execution Count:2224 | 2224 |
107 | else { | - |
108 | } executed: } Execution Count:66035 | 66035 |
109 | | - |
110 | if (always_show_decpt || digits.length() > 1) evaluated: always_show_decpt yes Evaluation Count:2226 | yes Evaluation Count:66044 |
evaluated: digits.length() > 1 yes Evaluation Count:64723 | yes Evaluation Count:1321 |
| 1321-66044 |
111 | digits.insert(1, decimal); executed: digits.insert(1, decimal); Execution Count:66949 | 66949 |
112 | | - |
113 | digits.append(exponential); | - |
114 | digits.append(QLocalePrivate::longLongToString(zero, group, plus, minus, | - |
115 | exp, 2, 10, -1, QLocalePrivate::AlwaysShowSign)); | - |
116 | | - |
117 | return digits; executed: return digits; Execution Count:68270 | 68270 |
118 | } | - |
119 | | - |
120 | | - |
121 | bool removeGroupSeparators(QLocalePrivate::CharBuff *num) | - |
122 | { | - |
123 | int group_cnt = 0; | - |
124 | int decpt_idx = -1; | - |
125 | | - |
126 | char *data = num->data(); | - |
127 | int l = qstrlen(data); | - |
128 | | - |
129 | | - |
130 | int i = 0; | - |
131 | for (; i < l; ++i) { evaluated: i < l yes Evaluation Count:34215 | yes Evaluation Count:13420 |
| 13420-34215 |
132 | char c = data[i]; | - |
133 | | - |
134 | if (c == ',') { evaluated: c == ',' yes Evaluation Count:132 | yes Evaluation Count:34083 |
| 132-34083 |
135 | if (i == 0 || data[i - 1] < '0' || data[i - 1] > '9') evaluated: i == 0 yes Evaluation Count:7 | yes Evaluation Count:125 |
evaluated: data[i - 1] < '0' yes Evaluation Count:1 | yes Evaluation Count:124 |
partially evaluated: data[i - 1] > '9' no Evaluation Count:0 | yes Evaluation Count:124 |
| 0-125 |
136 | return false; executed: return false; Execution Count:8 | 8 |
137 | if (i == l - 1 || data[i + 1] < '0' || data[i + 1] > '9') evaluated: i == l - 1 yes Evaluation Count:10 | yes Evaluation Count:114 |
evaluated: data[i + 1] < '0' yes Evaluation Count:5 | yes Evaluation Count:109 |
evaluated: data[i + 1] > '9' yes Evaluation Count:1 | yes Evaluation Count:108 |
| 1-114 |
138 | return false; executed: return false; Execution Count:16 | 16 |
139 | ++group_cnt; | - |
140 | } executed: } Execution Count:108 | 108 |
141 | else if (c == '.') { evaluated: c == '.' yes Evaluation Count:822 | yes Evaluation Count:33261 |
| 822-33261 |
142 | | - |
143 | if (decpt_idx != -1) evaluated: decpt_idx != -1 yes Evaluation Count:1 | yes Evaluation Count:821 |
| 1-821 |
144 | return false; executed: return false; Execution Count:1 | 1 |
145 | decpt_idx = i; | - |
146 | } else if (c == 'e' || c == 'E') { executed: } Execution Count:821 evaluated: c == 'e' yes Evaluation Count:33 | yes Evaluation Count:33228 |
partially evaluated: c == 'E' no Evaluation Count:0 | yes Evaluation Count:33228 |
| 0-33228 |
147 | | - |
148 | | - |
149 | if (decpt_idx == -1) evaluated: decpt_idx == -1 yes Evaluation Count:25 | yes Evaluation Count:8 |
| 8-25 |
150 | decpt_idx = i; executed: decpt_idx = i; Execution Count:25 | 25 |
151 | } executed: } Execution Count:33 | 33 |
152 | } | - |
153 | | - |
154 | | - |
155 | if (group_cnt == 0) evaluated: group_cnt == 0 yes Evaluation Count:13336 | yes Evaluation Count:84 |
| 84-13336 |
156 | return true; executed: return true; Execution Count:13336 | 13336 |
157 | | - |
158 | | - |
159 | if (decpt_idx == -1) evaluated: decpt_idx == -1 yes Evaluation Count:63 | yes Evaluation Count:21 |
| 21-63 |
160 | decpt_idx = l; executed: decpt_idx = l; Execution Count:63 | 63 |
161 | | - |
162 | i = 0; | - |
163 | while (i < l && group_cnt > 0) { partially evaluated: i < l yes Evaluation Count:262 | no Evaluation Count:0 |
evaluated: group_cnt > 0 yes Evaluation Count:225 | yes Evaluation Count:37 |
| 0-262 |
164 | char c = data[i]; | - |
165 | | - |
166 | if (c == ',') { evaluated: c == ',' yes Evaluation Count:67 | yes Evaluation Count:158 |
| 67-158 |
167 | | - |
168 | if (i > decpt_idx) evaluated: i > decpt_idx yes Evaluation Count:1 | yes Evaluation Count:66 |
| 1-66 |
169 | return false; executed: return false; Execution Count:1 | 1 |
170 | | - |
171 | | - |
172 | if ((decpt_idx - i) % 4 != 0) evaluated: (decpt_idx - i) % 4 != 0 yes Evaluation Count:13 | yes Evaluation Count:53 |
| 13-53 |
173 | return false; executed: return false; Execution Count:13 | 13 |
174 | | - |
175 | | - |
176 | memmove(data + i, data + i + 1, l - i - 1); | - |
177 | data[--l] = '\0'; | - |
178 | | - |
179 | --group_cnt; | - |
180 | --decpt_idx; | - |
181 | } else { executed: } Execution Count:53 | 53 |
182 | | - |
183 | if (i < decpt_idx evaluated: i < decpt_idx yes Evaluation Count:156 | yes Evaluation Count:2 |
| 2-156 |
184 | && (decpt_idx - i) % 4 == 0 evaluated: (decpt_idx - i) % 4 == 0 yes Evaluation Count:38 | yes Evaluation Count:118 |
| 38-118 |
185 | && !(i == 0 && (c == '-' || c == '+'))) evaluated: i == 0 yes Evaluation Count:37 | yes Evaluation Count:1 |
evaluated: c == '-' yes Evaluation Count:1 | yes Evaluation Count:36 |
evaluated: c == '+' yes Evaluation Count:4 | yes Evaluation Count:32 |
| 1-37 |
186 | return false; executed: return false; Execution Count:33 | 33 |
187 | ++i; | - |
188 | } executed: } Execution Count:125 | 125 |
189 | } | - |
190 | | - |
191 | return true; executed: return true; Execution Count:37 | 37 |
192 | } | - |
193 | qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, bool *ok) | - |
194 | { | - |
195 | register const char *s = nptr; | - |
196 | register qulonglong acc; | - |
197 | register unsigned char c; | - |
198 | register qulonglong qbase, cutoff; | - |
199 | register int any, cutlim; | - |
200 | | - |
201 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:51373 | no Evaluation Count:0 |
| 0-51373 |
202 | *ok = true; executed: *ok = true; Execution Count:51362 | 51362 |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
207 | s = nptr; | - |
208 | do { | - |
209 | c = *s++; | - |
210 | } while (isspace(c)); executed: } Execution Count:51383 partially evaluated: isspace(c) no Evaluation Count:0 | yes Evaluation Count:51347 |
| 0-51383 |
211 | if (c == '-') { evaluated: c == '-' yes Evaluation Count:25 | yes Evaluation Count:51311 |
| 25-51311 |
212 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
213 | *ok = false; executed: *ok = false; Execution Count:25 | 25 |
214 | if (endptr != 0) partially evaluated: endptr != 0 yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
215 | *endptr = s - 1; executed: *endptr = s - 1; Execution Count:25 | 25 |
216 | return 0; executed: return 0; Execution Count:25 | 25 |
217 | } else { | - |
218 | if (c == '+') partially evaluated: c == '+' no Evaluation Count:0 | yes Evaluation Count:51310 |
| 0-51310 |
219 | c = *s++; never executed: c = *s++; | 0 |
220 | } executed: } Execution Count:51307 | 51307 |
221 | if ((base == 0 || base == 16) && evaluated: base == 0 yes Evaluation Count:22459 | yes Evaluation Count:28847 |
evaluated: base == 16 yes Evaluation Count:13393 | yes Evaluation Count:15454 |
| 13393-28847 |
222 | c == '0' && (*s == 'x' || *s == 'X')) { evaluated: c == '0' yes Evaluation Count:2423 | yes Evaluation Count:33429 |
evaluated: *s == 'x' yes Evaluation Count:20 | yes Evaluation Count:2403 |
partially evaluated: *s == 'X' no Evaluation Count:0 | yes Evaluation Count:2403 |
| 0-33429 |
223 | c = s[1]; | - |
224 | s += 2; | - |
225 | base = 16; | - |
226 | } executed: } Execution Count:20 | 20 |
227 | if (base == 0) evaluated: base == 0 yes Evaluation Count:22459 | yes Evaluation Count:28855 |
| 22459-28855 |
228 | base = c == '0' ? 8 : 10; executed: base = c == '0' ? 8 : 10; Execution Count:22476 evaluated: c == '0' yes Evaluation Count:2270 | yes Evaluation Count:20202 |
| 2270-22476 |
229 | qbase = unsigned(base); | - |
230 | cutoff = qulonglong((9223372036854775807LL * 2ULL + 1)) / qbase; | - |
231 | cutlim = qulonglong((9223372036854775807LL * 2ULL + 1)) % qbase; | - |
232 | for (acc = 0, any = 0;; c = *s++) { | - |
233 | if (!isascii(c)) partially evaluated: !isascii(c) no Evaluation Count:0 | yes Evaluation Count:115485 |
| 0-115485 |
234 | break; | 0 |
235 | if (isdigit(c)) evaluated: isdigit(c) yes Evaluation Count:50494 | yes Evaluation Count:64989 |
| 50494-64989 |
236 | c -= '0'; executed: c -= '0'; Execution Count:50494 | 50494 |
237 | else if (isalpha(c)) evaluated: isalpha(c) yes Evaluation Count:29006 | yes Evaluation Count:35994 |
| 29006-35994 |
238 | c -= isupper(c) ? 'A' - 10 : 'a' - 10; executed: c -= isupper(c) ? 'A' - 10 : 'a' - 10; Execution Count:29006 evaluated: isupper(c) yes Evaluation Count:267 | yes Evaluation Count:28723 |
| 267-29006 |
239 | else | - |
240 | break; executed: break; Execution Count:35994 | 35994 |
241 | if (c >= base) evaluated: c >= base yes Evaluation Count:15411 | yes Evaluation Count:64075 |
| 15411-64075 |
242 | break; executed: break; Execution Count:15418 | 15418 |
243 | if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) partially evaluated: any < 0 no Evaluation Count:0 | yes Evaluation Count:64075 |
partially evaluated: acc > cutoff no Evaluation Count:0 | yes Evaluation Count:64075 |
evaluated: acc == cutoff yes Evaluation Count:8 | yes Evaluation Count:64067 |
evaluated: c > cutlim yes Evaluation Count:3 | yes Evaluation Count:5 |
| 0-64075 |
244 | any = -1; executed: any = -1; Execution Count:3 | 3 |
245 | else { | - |
246 | any = 1; | - |
247 | acc *= qbase; | - |
248 | acc += c; | - |
249 | } executed: } Execution Count:64073 | 64073 |
250 | } | - |
251 | if (any == 0) { evaluated: any == 0 yes Evaluation Count:16286 | yes Evaluation Count:35115 |
| 16286-35115 |
252 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:16285 | no Evaluation Count:0 |
| 0-16285 |
253 | *ok = false; executed: *ok = false; Execution Count:16292 | 16292 |
254 | } else if (any < 0) { evaluated: any < 0 yes Evaluation Count:3 | yes Evaluation Count:35112 |
executed: } Execution Count:16300 | 3-35112 |
255 | acc = (9223372036854775807LL * 2ULL + 1); | - |
256 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
257 | *ok = false; executed: *ok = false; Execution Count:3 | 3 |
258 | } executed: } Execution Count:3 | 3 |
259 | if (endptr != 0) partially evaluated: endptr != 0 yes Evaluation Count:51394 | no Evaluation Count:0 |
| 0-51394 |
260 | *endptr = (any ? s - 1 : nptr); executed: *endptr = (any ? s - 1 : nptr); Execution Count:51348 evaluated: any yes Evaluation Count:35115 | yes Evaluation Count:16250 |
| 16250-51348 |
261 | return acc; executed: return acc; Execution Count:51401 | 51401 |
262 | } | - |
263 | qlonglong qstrtoll(const char *nptr, const char **endptr, register int base, bool *ok) | - |
264 | { | - |
265 | register const char *s; | - |
266 | register qulonglong acc; | - |
267 | register unsigned char c; | - |
268 | register qulonglong qbase, cutoff; | - |
269 | register int neg, any, cutlim; | - |
270 | | - |
271 | | - |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | s = nptr; | - |
277 | do { | - |
278 | c = *s++; | - |
279 | } while (isspace(c)); executed: } Execution Count:254823 partially evaluated: isspace(c) no Evaluation Count:0 | yes Evaluation Count:254823 |
| 0-254823 |
280 | if (c == '-') { evaluated: c == '-' yes Evaluation Count:238 | yes Evaluation Count:254585 |
| 238-254585 |
281 | neg = 1; | - |
282 | c = *s++; | - |
283 | } else { executed: } Execution Count:238 | 238 |
284 | neg = 0; | - |
285 | if (c == '+') evaluated: c == '+' yes Evaluation Count:10 | yes Evaluation Count:254575 |
| 10-254575 |
286 | c = *s++; executed: c = *s++; Execution Count:10 | 10 |
287 | } executed: } Execution Count:254585 | 254585 |
288 | if ((base == 0 || base == 16) && evaluated: base == 0 yes Evaluation Count:53 | yes Evaluation Count:254770 |
evaluated: base == 16 yes Evaluation Count:176337 | yes Evaluation Count:78434 |
| 53-254770 |
289 | c == '0' && (*s == 'x' || *s == 'X')) { evaluated: c == '0' yes Evaluation Count:49079 | yes Evaluation Count:127311 |
evaluated: *s == 'x' yes Evaluation Count:41 | yes Evaluation Count:49038 |
partially evaluated: *s == 'X' no Evaluation Count:0 | yes Evaluation Count:49038 |
| 0-127311 |
290 | c = s[1]; | - |
291 | s += 2; | - |
292 | base = 16; | - |
293 | } executed: } Execution Count:41 | 41 |
294 | if (base == 0) evaluated: base == 0 yes Evaluation Count:34 | yes Evaluation Count:254789 |
| 34-254789 |
295 | base = c == '0' ? 8 : 10; executed: base = c == '0' ? 8 : 10; Execution Count:34 evaluated: c == '0' yes Evaluation Count:19 | yes Evaluation Count:15 |
| 15-34 |
296 | qbase = unsigned(base); | - |
297 | cutoff = neg ? qulonglong(0-((-9223372036854775807LL -1) + 9223372036854775807LL)) + 9223372036854775807LL : 9223372036854775807LL; evaluated: neg yes Evaluation Count:238 | yes Evaluation Count:254585 |
| 238-254585 |
298 | cutlim = cutoff % qbase; | - |
299 | cutoff /= qbase; | - |
300 | for (acc = 0, any = 0;; c = *s++) { | - |
301 | if (!isascii(c)) partially evaluated: !isascii(c) no Evaluation Count:0 | yes Evaluation Count:1163443 |
| 0-1163443 |
302 | break; | 0 |
303 | if (isdigit(c)) evaluated: isdigit(c) yes Evaluation Count:629352 | yes Evaluation Count:534092 |
| 534092-629352 |
304 | c -= '0'; executed: c -= '0'; Execution Count:629352 | 629352 |
305 | else if (isalpha(c)) evaluated: isalpha(c) yes Evaluation Count:279433 | yes Evaluation Count:254657 |
| 254657-279433 |
306 | c -= isupper(c) ? 'A' - 10 : 'a' - 10; executed: c -= isupper(c) ? 'A' - 10 : 'a' - 10; Execution Count:279433 evaluated: isupper(c) yes Evaluation Count:177974 | yes Evaluation Count:101459 |
| 101459-279433 |
307 | else | - |
308 | break; executed: break; Execution Count:254657 | 254657 |
309 | if (c >= base) evaluated: c >= base yes Evaluation Count:164 | yes Evaluation Count:908621 |
| 164-908621 |
310 | break; executed: break; Execution Count:164 | 164 |
311 | if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) partially evaluated: any < 0 no Evaluation Count:0 | yes Evaluation Count:908622 |
evaluated: acc > cutoff yes Evaluation Count:1 | yes Evaluation Count:908620 |
evaluated: acc == cutoff yes Evaluation Count:11 | yes Evaluation Count:908611 |
evaluated: c > cutlim yes Evaluation Count:3 | yes Evaluation Count:8 |
| 0-908622 |
312 | any = -1; executed: any = -1; Execution Count:4 | 4 |
313 | else { | - |
314 | any = 1; | - |
315 | acc *= qbase; | - |
316 | acc += c; | - |
317 | } executed: } Execution Count:908619 | 908619 |
318 | } | - |
319 | if (any < 0) { evaluated: any < 0 yes Evaluation Count:4 | yes Evaluation Count:254817 |
| 4-254817 |
320 | acc = neg ? (-9223372036854775807LL -1) : 9223372036854775807LL; evaluated: neg yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
321 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
322 | *ok = false; executed: *ok = false; Execution Count:4 | 4 |
323 | } else if (neg) { evaluated: neg yes Evaluation Count:236 | yes Evaluation Count:254581 |
executed: } Execution Count:4 | 4-254581 |
324 | acc = (~acc) + 1; | - |
325 | } executed: } Execution Count:236 | 236 |
326 | if (endptr != 0) partially evaluated: endptr != 0 yes Evaluation Count:254821 | no Evaluation Count:0 |
| 0-254821 |
327 | *endptr = (any >= 0 ? s - 1 : nptr); evaluated: any >= 0 yes Evaluation Count:254817 | yes Evaluation Count:4 |
executed: *endptr = (any >= 0 ? s - 1 : nptr); Execution Count:254821 | 4-254821 |
328 | | - |
329 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:254822 | no Evaluation Count:0 |
| 0-254822 |
330 | *ok = any > 0; executed: *ok = any > 0; Execution Count:254821 | 254821 |
331 | | - |
332 | return acc; executed: return acc; Execution Count:254821 | 254821 |
333 | } | - |
334 | static inline quint32 getWord0(const volatile double x) | - |
335 | { | - |
336 | const volatile uchar *ptr = reinterpret_cast<const volatile uchar *>(&x); | - |
337 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { partially evaluated: QSysInfo::ByteOrder == QSysInfo::BigEndian no Evaluation Count:0 | yes Evaluation Count:13725407 |
| 0-13725407 |
338 | return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; never executed: return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; | 0 |
339 | } else { | - |
340 | return (ptr[7]<<24) + (ptr[6]<<16) + (ptr[5]<<8) + ptr[4]; executed: return (ptr[7]<<24) + (ptr[6]<<16) + (ptr[5]<<8) + ptr[4]; Execution Count:13725407 | 13725407 |
341 | } | - |
342 | } | - |
343 | | - |
344 | static inline void setWord0(volatile double *x, quint32 l) | - |
345 | { | - |
346 | volatile uchar *ptr = reinterpret_cast<volatile uchar *>(x); | - |
347 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { partially evaluated: QSysInfo::ByteOrder == QSysInfo::BigEndian no Evaluation Count:0 | yes Evaluation Count:6325072 |
| 0-6325072 |
348 | ptr[0] = uchar(l>>24); | - |
349 | ptr[1] = uchar(l>>16); | - |
350 | ptr[2] = uchar(l>>8); | - |
351 | ptr[3] = uchar(l); | - |
352 | } else { | 0 |
353 | ptr[7] = uchar(l>>24); | - |
354 | ptr[6] = uchar(l>>16); | - |
355 | ptr[5] = uchar(l>>8); | - |
356 | ptr[4] = uchar(l); | - |
357 | } executed: } Execution Count:6325072 | 6325072 |
358 | } | - |
359 | | - |
360 | static inline quint32 getWord1(const volatile double x) | - |
361 | { | - |
362 | const volatile uchar *ptr = reinterpret_cast<const volatile uchar *>(&x); | - |
363 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { partially evaluated: QSysInfo::ByteOrder == QSysInfo::BigEndian no Evaluation Count:0 | yes Evaluation Count:1463306 |
| 0-1463306 |
364 | return (ptr[4]<<24) + (ptr[5]<<16) + (ptr[6]<<8) + ptr[7]; never executed: return (ptr[4]<<24) + (ptr[5]<<16) + (ptr[6]<<8) + ptr[7]; | 0 |
365 | } else { | - |
366 | return (ptr[3]<<24) + (ptr[2]<<16) + (ptr[1]<<8) + ptr[0]; executed: return (ptr[3]<<24) + (ptr[2]<<16) + (ptr[1]<<8) + ptr[0]; Execution Count:1463306 | 1463306 |
367 | } | - |
368 | } | - |
369 | static inline void setWord1(volatile double *x, quint32 l) | - |
370 | { | - |
371 | volatile uchar *ptr = reinterpret_cast<uchar volatile *>(x); | - |
372 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { partially evaluated: QSysInfo::ByteOrder == QSysInfo::BigEndian no Evaluation Count:0 | yes Evaluation Count:400 |
| 0-400 |
373 | ptr[4] = uchar(l>>24); | - |
374 | ptr[5] = uchar(l>>16); | - |
375 | ptr[6] = uchar(l>>8); | - |
376 | ptr[7] = uchar(l); | - |
377 | } else { | 0 |
378 | ptr[3] = uchar(l>>24); | - |
379 | ptr[2] = uchar(l>>16); | - |
380 | ptr[1] = uchar(l>>8); | - |
381 | ptr[0] = uchar(l); | - |
382 | } executed: } Execution Count:400 | 400 |
383 | } | - |
384 | | - |
385 | static inline void Storeinc(quint32 *&a, const quint32 &b, const quint32 &c) | - |
386 | { | - |
387 | | - |
388 | *a = (ushort(b) << 16) | ushort(c); | - |
389 | ++a; | - |
390 | } executed: } Execution Count:972173 | 972173 |
391 | struct | - |
392 | Bigint { | - |
393 | struct Bigint *next; | - |
394 | int k, maxwds, sign, wds; | - |
395 | quint32 x[1]; | - |
396 | }; | - |
397 | | - |
398 | typedef struct Bigint Bigint; | - |
399 | | - |
400 | static Bigint *Balloc(int k) | - |
401 | { | - |
402 | int x; | - |
403 | Bigint *rv; | - |
404 | | - |
405 | x = 1 << k; | - |
406 | rv = static_cast<Bigint *>(malloc(sizeof(Bigint) + (x-1)*sizeof(qint32))); | - |
407 | do { if (!(rv)) qBadAlloc(); } while (0); partially evaluated: !(rv) no Evaluation Count:0 | yes Evaluation Count:1476124 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1476124 |
never executed: qBadAlloc(); executed: } Execution Count:1476124 | 0-1476124 |
408 | rv->k = k; | - |
409 | rv->maxwds = x; | - |
410 | rv->sign = rv->wds = 0; | - |
411 | return rv; executed: return rv; Execution Count:1476124 | 1476124 |
412 | } | - |
413 | | - |
414 | static void Bfree(Bigint *v) | - |
415 | { | - |
416 | free(v); | - |
417 | } executed: } Execution Count:1476126 | 1476126 |
418 | | - |
419 | | - |
420 | | - |
421 | | - |
422 | | - |
423 | static Bigint *multadd(Bigint *b, int m, int a) | - |
424 | { | - |
425 | int i, wds; | - |
426 | quint32 *x, y; | - |
427 | | - |
428 | quint32 xi, z; | - |
429 | | - |
430 | Bigint *b1; | - |
431 | | - |
432 | wds = b->wds; | - |
433 | x = b->x; | - |
434 | i = 0; | - |
435 | do { | - |
436 | | - |
437 | xi = *x; | - |
438 | y = (xi & 0xffff) * m + a; | - |
439 | z = (xi >> 16) * m + (y >> 16); | - |
440 | a = (z >> 16); | - |
441 | *x++ = (z << 16) + (y & 0xffff); | - |
442 | | - |
443 | | - |
444 | | - |
445 | | - |
446 | | - |
447 | } executed: } Execution Count:1276789 | 1276789 |
448 | while(++i < wds); evaluated: ++i < wds yes Evaluation Count:1133800 | yes Evaluation Count:142989 |
| 142989-1133800 |
449 | if (a) { evaluated: a yes Evaluation Count:2045 | yes Evaluation Count:140944 |
| 2045-140944 |
450 | if (wds >= b->maxwds) { partially evaluated: wds >= b->maxwds no Evaluation Count:0 | yes Evaluation Count:2045 |
| 0-2045 |
451 | b1 = Balloc(b->k+1); | - |
452 | memcpy(reinterpret_cast<char *>(&b1->sign), reinterpret_cast<char *>(&b->sign), b->wds*sizeof(qint32) + 2*sizeof(int)); | - |
453 | Bfree(b); | - |
454 | b = b1; | - |
455 | } | 0 |
456 | b->x[wds++] = a; | - |
457 | b->wds = wds; | - |
458 | } executed: } Execution Count:2045 | 2045 |
459 | return b; executed: return b; Execution Count:142989 | 142989 |
460 | } | - |
461 | | - |
462 | static Bigint *s2b(const char *s, int nd0, int nd, quint32 y9) | - |
463 | { | - |
464 | Bigint *b; | - |
465 | int i, k; | - |
466 | qint32 x, y; | - |
467 | | - |
468 | x = (nd + 8) / 9; | - |
469 | for(k = 0, y = 1; x > y; y <<= 1, k++) ; executed: ; Execution Count:517 evaluated: x > y yes Evaluation Count:517 | yes Evaluation Count:161 |
| 161-517 |
470 | | - |
471 | b = Balloc(k); | - |
472 | b->x[0] = y9; | - |
473 | b->wds = 1; | - |
474 | | - |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | | - |
480 | i = 9; | - |
481 | if (9 < nd0) { evaluated: 9 < nd0 yes Evaluation Count:129 | yes Evaluation Count:32 |
| 32-129 |
482 | s += 9; | - |
483 | do b = multadd(b, 10, *s++ - '0'); executed: b = multadd(b, 10, *s++ - '0'); Execution Count:18442 | 18442 |
484 | while(++i < nd0); evaluated: ++i < nd0 yes Evaluation Count:18313 | yes Evaluation Count:129 |
| 129-18313 |
485 | s++; | - |
486 | } executed: } Execution Count:129 | 129 |
487 | else | - |
488 | s += 10; executed: s += 10; Execution Count:32 | 32 |
489 | for(; i < nd; i++) evaluated: i < nd yes Evaluation Count:334 | yes Evaluation Count:161 |
| 161-334 |
490 | b = multadd(b, 10, *s++ - '0'); executed: b = multadd(b, 10, *s++ - '0'); Execution Count:334 | 334 |
491 | return b; executed: return b; Execution Count:161 | 161 |
492 | } | - |
493 | | - |
494 | static int hi0bits(quint32 x) | - |
495 | { | - |
496 | int k = 0; | - |
497 | | - |
498 | if (!(x & 0xffff0000)) { evaluated: !(x & 0xffff0000) yes Evaluation Count:486 | yes Evaluation Count:411 |
| 411-486 |
499 | k = 16; | - |
500 | x <<= 16; | - |
501 | } executed: } Execution Count:486 | 486 |
502 | if (!(x & 0xff000000)) { evaluated: !(x & 0xff000000) yes Evaluation Count:395 | yes Evaluation Count:502 |
| 395-502 |
503 | k += 8; | - |
504 | x <<= 8; | - |
505 | } executed: } Execution Count:395 | 395 |
506 | if (!(x & 0xf0000000)) { evaluated: !(x & 0xf0000000) yes Evaluation Count:419 | yes Evaluation Count:478 |
| 419-478 |
507 | k += 4; | - |
508 | x <<= 4; | - |
509 | } executed: } Execution Count:419 | 419 |
510 | if (!(x & 0xc0000000)) { evaluated: !(x & 0xc0000000) yes Evaluation Count:527 | yes Evaluation Count:370 |
| 370-527 |
511 | k += 2; | - |
512 | x <<= 2; | - |
513 | } executed: } Execution Count:527 | 527 |
514 | if (!(x & 0x80000000)) { evaluated: !(x & 0x80000000) yes Evaluation Count:619 | yes Evaluation Count:278 |
| 278-619 |
515 | k++; | - |
516 | if (!(x & 0x40000000)) partially evaluated: !(x & 0x40000000) no Evaluation Count:0 | yes Evaluation Count:619 |
| 0-619 |
517 | return 32; never executed: return 32; | 0 |
518 | } executed: } Execution Count:619 | 619 |
519 | return k; executed: return k; Execution Count:897 | 897 |
520 | } | - |
521 | | - |
522 | static int lo0bits(quint32 *y) | - |
523 | { | - |
524 | int k; | - |
525 | quint32 x = *y; | - |
526 | | - |
527 | if (x & 7) { evaluated: x & 7 yes Evaluation Count:23206 | yes Evaluation Count:1440058 |
| 23206-1440058 |
528 | if (x & 1) evaluated: x & 1 yes Evaluation Count:10888 | yes Evaluation Count:12318 |
| 10888-12318 |
529 | return 0; executed: return 0; Execution Count:10888 | 10888 |
530 | if (x & 2) { evaluated: x & 2 yes Evaluation Count:6418 | yes Evaluation Count:5900 |
| 5900-6418 |
531 | *y = x >> 1; | - |
532 | return 1; executed: return 1; Execution Count:6418 | 6418 |
533 | } | - |
534 | *y = x >> 2; | - |
535 | return 2; executed: return 2; Execution Count:5900 | 5900 |
536 | } | - |
537 | k = 0; | - |
538 | if (!(x & 0xffff)) { evaluated: !(x & 0xffff) yes Evaluation Count:717529 | yes Evaluation Count:722529 |
| 717529-722529 |
539 | k = 16; | - |
540 | x >>= 16; | - |
541 | } executed: } Execution Count:717529 | 717529 |
542 | if (!(x & 0xff)) { evaluated: !(x & 0xff) yes Evaluation Count:743001 | yes Evaluation Count:697057 |
| 697057-743001 |
543 | k += 8; | - |
544 | x >>= 8; | - |
545 | } executed: } Execution Count:743001 | 743001 |
546 | if (!(x & 0xf)) { evaluated: !(x & 0xf) yes Evaluation Count:874527 | yes Evaluation Count:565531 |
| 565531-874527 |
547 | k += 4; | - |
548 | x >>= 4; | - |
549 | } executed: } Execution Count:874527 | 874527 |
550 | if (!(x & 0x3)) { evaluated: !(x & 0x3) yes Evaluation Count:677243 | yes Evaluation Count:762815 |
| 677243-762815 |
551 | k += 2; | - |
552 | x >>= 2; | - |
553 | } executed: } Execution Count:677243 | 677243 |
554 | if (!(x & 1)) { evaluated: !(x & 1) yes Evaluation Count:675203 | yes Evaluation Count:764855 |
| 675203-764855 |
555 | k++; | - |
556 | x >>= 1; | - |
557 | if (!x & 1) partially evaluated: !x & 1 no Evaluation Count:0 | yes Evaluation Count:675203 |
| 0-675203 |
558 | return 32; never executed: return 32; | 0 |
559 | } executed: } Execution Count:675203 | 675203 |
560 | *y = x; | - |
561 | return k; executed: return k; Execution Count:1440058 | 1440058 |
562 | } | - |
563 | | - |
564 | static Bigint *i2b(int i) | - |
565 | { | - |
566 | Bigint *b; | - |
567 | | - |
568 | b = Balloc(1); | - |
569 | b->x[0] = i; | - |
570 | b->wds = 1; | - |
571 | return b; executed: return b; Execution Count:2398 | 2398 |
572 | } | - |
573 | | - |
574 | static Bigint *mult(Bigint *a, Bigint *b) | - |
575 | { | - |
576 | Bigint *c; | - |
577 | int k, wa, wb, wc; | - |
578 | quint32 carry, y, z; | - |
579 | quint32 *x, *xa, *xae, *xb, *xbe, *xc, *xc0; | - |
580 | | - |
581 | quint32 z2; | - |
582 | | - |
583 | | - |
584 | if (a->wds < b->wds) { evaluated: a->wds < b->wds yes Evaluation Count:1570 | yes Evaluation Count:1451 |
| 1451-1570 |
585 | c = a; | - |
586 | a = b; | - |
587 | b = c; | - |
588 | } executed: } Execution Count:1570 | 1570 |
589 | k = a->k; | - |
590 | wa = a->wds; | - |
591 | wb = b->wds; | - |
592 | wc = wa + wb; | - |
593 | if (wc > a->maxwds) evaluated: wc > a->maxwds yes Evaluation Count:1619 | yes Evaluation Count:1402 |
| 1402-1619 |
594 | k++; executed: k++; Execution Count:1619 | 1619 |
595 | c = Balloc(k); | - |
596 | for(x = c->x, xa = x + wc; x < xa; x++) evaluated: x < xa yes Evaluation Count:17702 | yes Evaluation Count:3021 |
| 3021-17702 |
597 | *x = 0; executed: *x = 0; Execution Count:17702 | 17702 |
598 | xa = a->x; | - |
599 | xae = xa + wa; | - |
600 | xb = b->x; | - |
601 | xbe = xb + wb; | - |
602 | xc0 = c->x; | - |
603 | | - |
604 | for(; xb < xbe; xb++, xc0++) { evaluated: xb < xbe yes Evaluation Count:5645 | yes Evaluation Count:3021 |
| 3021-5645 |
605 | if ((y = *xb & 0xffff) != 0) { partially evaluated: (y = *xb & 0xffff) != 0 yes Evaluation Count:5645 | no Evaluation Count:0 |
| 0-5645 |
606 | x = xa; | - |
607 | xc = xc0; | - |
608 | carry = 0; | - |
609 | do { | - |
610 | z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; | - |
611 | carry = z >> 16; | - |
612 | z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; | - |
613 | carry = z2 >> 16; | - |
614 | Storeinc(xc, z2, z); | - |
615 | } executed: } Execution Count:36492 | 36492 |
616 | while(x < xae); evaluated: x < xae yes Evaluation Count:30847 | yes Evaluation Count:5645 |
| 5645-30847 |
617 | *xc = carry; | - |
618 | } executed: } Execution Count:5645 | 5645 |
619 | if ((y = *xb >> 16) != 0) { evaluated: (y = *xb >> 16) != 0 yes Evaluation Count:3376 | yes Evaluation Count:2269 |
| 2269-3376 |
620 | x = xa; | - |
621 | xc = xc0; | - |
622 | carry = 0; | - |
623 | z2 = *xc; | - |
624 | do { | - |
625 | z = (*x & 0xffff) * y + (*xc >> 16) + carry; | - |
626 | carry = z >> 16; | - |
627 | Storeinc(xc, z, z2); | - |
628 | z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; | - |
629 | carry = z2 >> 16; | - |
630 | } executed: } Execution Count:30540 | 30540 |
631 | while(x < xae); evaluated: x < xae yes Evaluation Count:27164 | yes Evaluation Count:3376 |
| 3376-27164 |
632 | *xc = z2; | - |
633 | } executed: } Execution Count:3376 | 3376 |
634 | } executed: } Execution Count:5645 | 5645 |
635 | for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; executed: ; Execution Count:2160 partially evaluated: wc > 0 yes Evaluation Count:5181 | no Evaluation Count:0 |
evaluated: !*--xc yes Evaluation Count:2160 | yes Evaluation Count:3021 |
| 0-5181 |
636 | c->wds = wc; | - |
637 | return c; executed: return c; Execution Count:3021 | 3021 |
638 | } | - |
639 | | - |
640 | static Bigint *p5s; | - |
641 | | - |
642 | struct p5s_deleter | - |
643 | { | - |
644 | ~p5s_deleter() | - |
645 | { | - |
646 | while (p5s) { evaluated: p5s yes Evaluation Count:29 | yes Evaluation Count:5 |
| 5-29 |
647 | Bigint *next = p5s->next; | - |
648 | Bfree(p5s); | - |
649 | p5s = next; | - |
650 | } executed: } Execution Count:29 | 29 |
651 | } executed: } Execution Count:5 | 5 |
652 | }; | - |
653 | | - |
654 | static Bigint *pow5mult(Bigint *b, int k) | - |
655 | { | - |
656 | Bigint *b1, *p5, *p51; | - |
657 | int i; | - |
658 | static const int p05[3] = { 5, 25, 125 }; | - |
659 | | - |
660 | if ((i = k & 3) != 0) evaluated: (i = k & 3) != 0 yes Evaluation Count:1487 | yes Evaluation Count:395 |
| 395-1487 |
661 | | - |
662 | | - |
663 | | - |
664 | | - |
665 | | - |
666 | | - |
667 | | - |
668 | b = multadd(b, p05[i-1], 0); executed: b = multadd(b, p05[i-1], 0); Execution Count:1487 | 1487 |
669 | | - |
670 | | - |
671 | if (!(k >>= 2)) evaluated: !(k >>= 2) yes Evaluation Count:622 | yes Evaluation Count:1260 |
| 622-1260 |
672 | return b; executed: return b; Execution Count:622 | 622 |
673 | if (!(p5 = p5s)) { evaluated: !(p5 = p5s) yes Evaluation Count:5 | yes Evaluation Count:1255 |
| 5-1255 |
674 | | - |
675 | static p5s_deleter deleter; | - |
676 | p5 = p5s = i2b(625); | - |
677 | p5->next = 0; | - |
678 | } executed: } Execution Count:5 | 5 |
679 | for(;;) { | - |
680 | if (k & 1) { evaluated: k & 1 yes Evaluation Count:2910 | yes Evaluation Count:2376 |
| 2376-2910 |
681 | b1 = mult(b, p5); | - |
682 | Bfree(b); | - |
683 | b = b1; | - |
684 | } executed: } Execution Count:2910 | 2910 |
685 | if (!(k >>= 1)) evaluated: !(k >>= 1) yes Evaluation Count:1260 | yes Evaluation Count:4026 |
| 1260-4026 |
686 | break; executed: break; Execution Count:1260 | 1260 |
687 | if (!(p51 = p5->next)) { evaluated: !(p51 = p5->next) yes Evaluation Count:24 | yes Evaluation Count:4002 |
| 24-4002 |
688 | p51 = p5->next = mult(p5,p5); | - |
689 | p51->next = 0; | - |
690 | } executed: } Execution Count:24 | 24 |
691 | p5 = p51; | - |
692 | } executed: } Execution Count:4026 | 4026 |
693 | return b; executed: return b; Execution Count:1260 | 1260 |
694 | } | - |
695 | | - |
696 | static Bigint *lshift(Bigint *b, int k) | - |
697 | { | - |
698 | int i, k1, n, n1; | - |
699 | Bigint *b1; | - |
700 | quint32 *x, *x1, *xe, z; | - |
701 | | - |
702 | | - |
703 | n = k >> 5; | - |
704 | | - |
705 | | - |
706 | | - |
707 | k1 = b->k; | - |
708 | n1 = n + b->wds + 1; | - |
709 | for(i = b->maxwds; n1 > i; i <<= 1) evaluated: n1 > i yes Evaluation Count:5466 | yes Evaluation Count:6954 |
| 5466-6954 |
710 | k1++; executed: k1++; Execution Count:5466 | 5466 |
711 | b1 = Balloc(k1); | - |
712 | x1 = b1->x; | - |
713 | for(i = 0; i < n; i++) evaluated: i < n yes Evaluation Count:13897 | yes Evaluation Count:6954 |
| 6954-13897 |
714 | *x1++ = 0; executed: *x1++ = 0; Execution Count:13897 | 13897 |
715 | x = b->x; | - |
716 | xe = x + b->wds; | - |
717 | | - |
718 | if (k &= 0x1f) { evaluated: k &= 0x1f yes Evaluation Count:6945 | yes Evaluation Count:9 |
| 9-6945 |
719 | k1 = 32 - k; | - |
720 | z = 0; | - |
721 | do { | - |
722 | *x1++ = *x << k | z; | - |
723 | z = *x++ >> k1; | - |
724 | } executed: } Execution Count:26454 | 26454 |
725 | while(x < xe); evaluated: x < xe yes Evaluation Count:19509 | yes Evaluation Count:6945 |
| 6945-19509 |
726 | if ((*x1 = z) != 0) evaluated: (*x1 = z) != 0 yes Evaluation Count:114 | yes Evaluation Count:6831 |
| 114-6831 |
727 | ++n1; executed: ++n1; Execution Count:114 | 114 |
728 | } executed: } Execution Count:6945 | 6945 |
729 | else do | - |
730 | *x1++ = *x++; executed: *x1++ = *x++; Execution Count:26 | 26 |
731 | while(x < xe); evaluated: x < xe yes Evaluation Count:17 | yes Evaluation Count:9 |
| 9-17 |
732 | b1->wds = n1 - 1; | - |
733 | Bfree(b); | - |
734 | return b1; executed: return b1; Execution Count:6954 | 6954 |
735 | } | - |
736 | | - |
737 | static int cmp(Bigint *a, Bigint *b) | - |
738 | { | - |
739 | quint32 *xa, *xa0, *xb, *xb0; | - |
740 | int i, j; | - |
741 | | - |
742 | i = a->wds; | - |
743 | j = b->wds; | - |
744 | | - |
745 | | - |
746 | | - |
747 | | - |
748 | | - |
749 | | - |
750 | if (i -= j) evaluated: i -= j yes Evaluation Count:538 | yes Evaluation Count:124147 |
| 538-124147 |
751 | return i; executed: return i; Execution Count:538 | 538 |
752 | xa0 = a->x; | - |
753 | xa = xa0 + j; | - |
754 | xb0 = b->x; | - |
755 | xb = xb0 + j; | - |
756 | for(;;) { | - |
757 | if (*--xa != *--xb) evaluated: *--xa != *--xb yes Evaluation Count:123564 | yes Evaluation Count:4221 |
| 4221-123564 |
758 | return *xa < *xb ? -1 : 1; executed: return *xa < *xb ? -1 : 1; Execution Count:123564 | 123564 |
759 | if (xa <= xa0) evaluated: xa <= xa0 yes Evaluation Count:583 | yes Evaluation Count:3638 |
| 583-3638 |
760 | break; executed: break; Execution Count:583 | 583 |
761 | } executed: } Execution Count:3638 | 3638 |
762 | return 0; executed: return 0; Execution Count:583 | 583 |
763 | } | - |
764 | | - |
765 | static Bigint *diff(Bigint *a, Bigint *b) | - |
766 | { | - |
767 | Bigint *c; | - |
768 | int i, wa, wb; | - |
769 | qint32 borrow, y; | - |
770 | quint32 *xa, *xae, *xb, *xbe, *xc; | - |
771 | | - |
772 | qint32 z; | - |
773 | | - |
774 | | - |
775 | i = cmp(a,b); | - |
776 | if (!i) { evaluated: !i yes Evaluation Count:2 | yes Evaluation Count:161 |
| 2-161 |
777 | c = Balloc(0); | - |
778 | c->wds = 1; | - |
779 | c->x[0] = 0; | - |
780 | return c; executed: return c; Execution Count:2 | 2 |
781 | } | - |
782 | if (i < 0) { evaluated: i < 0 yes Evaluation Count:139 | yes Evaluation Count:22 |
| 22-139 |
783 | c = a; | - |
784 | a = b; | - |
785 | b = c; | - |
786 | i = 1; | - |
787 | } executed: } Execution Count:139 | 139 |
788 | else | - |
789 | i = 0; executed: i = 0; Execution Count:22 | 22 |
790 | c = Balloc(a->k); | - |
791 | c->sign = i; | - |
792 | wa = a->wds; | - |
793 | xa = a->x; | - |
794 | xae = xa + wa; | - |
795 | wb = b->wds; | - |
796 | xb = b->x; | - |
797 | xbe = xb + wb; | - |
798 | xc = c->x; | - |
799 | borrow = 0; | - |
800 | | - |
801 | do { | - |
802 | y = (*xa & 0xffff) - (*xb & 0xffff) + borrow; | - |
803 | borrow = y >> 16; | - |
804 | ; | - |
805 | z = (*xa++ >> 16) - (*xb++ >> 16) + borrow; | - |
806 | borrow = z >> 16; | - |
807 | ; | - |
808 | Storeinc(xc, z, y); | - |
809 | } executed: } Execution Count:2417 | 2417 |
810 | while(xb < xbe); evaluated: xb < xbe yes Evaluation Count:2256 | yes Evaluation Count:161 |
| 161-2256 |
811 | while(xa < xae) { partially evaluated: xa < xae no Evaluation Count:0 | yes Evaluation Count:161 |
| 0-161 |
812 | y = (*xa & 0xffff) + borrow; | - |
813 | borrow = y >> 16; | - |
814 | ; | - |
815 | z = (*xa++ >> 16) + borrow; | - |
816 | borrow = z >> 16; | - |
817 | ; | - |
818 | Storeinc(xc, z, y); | - |
819 | } | 0 |
820 | while(!*--xc) evaluated: !*--xc yes Evaluation Count:240 | yes Evaluation Count:161 |
| 161-240 |
821 | wa--; executed: wa--; Execution Count:240 | 240 |
822 | c->wds = wa; | - |
823 | return c; executed: return c; Execution Count:161 | 161 |
824 | } | - |
825 | | - |
826 | static double ulp(double x) | - |
827 | { | - |
828 | qint32 L; | - |
829 | double a; | - |
830 | | - |
831 | L = (getWord0(x) & 0x7ff00000) - (53 -1)*0x100000; | - |
832 | | - |
833 | if (L > 0) { partially evaluated: L > 0 yes Evaluation Count:133 | no Evaluation Count:0 |
| 0-133 |
834 | | - |
835 | | - |
836 | | - |
837 | | - |
838 | setWord0(&a, L); | - |
839 | setWord1(&a, 0); | - |
840 | | - |
841 | } executed: } Execution Count:133 | 133 |
842 | else { | - |
843 | L = -L >> 20; | - |
844 | if (L < 20) { | 0 |
845 | setWord0(&a, 0x80000 >> L); | - |
846 | setWord1(&a, 0); | - |
847 | } | 0 |
848 | else { | - |
849 | setWord0(&a, 0); | - |
850 | L -= 20; | - |
851 | setWord1(&a, L >= 31 ? 1U : 1U << (31 - L)); | - |
852 | } | 0 |
853 | } | - |
854 | | - |
855 | return a; executed: return a; Execution Count:133 | 133 |
856 | } | - |
857 | | - |
858 | static double b2d(Bigint *a, int *e) | - |
859 | { | - |
860 | quint32 *xa, *xa0, w, y, z; | - |
861 | int k; | - |
862 | double d; | - |
863 | | - |
864 | xa0 = a->x; | - |
865 | xa = xa0 + a->wds; | - |
866 | y = *--xa; | - |
867 | | - |
868 | | - |
869 | | - |
870 | k = hi0bits(y); | - |
871 | *e = 32 - k; | - |
872 | | - |
873 | if (k < 11) { evaluated: k < 11 yes Evaluation Count:60 | yes Evaluation Count:206 |
| 60-206 |
874 | setWord0(&d, 0x3ff00000 | y >> (11 - k)); | - |
875 | w = xa > xa0 ? *--xa : 0; partially evaluated: xa > xa0 yes Evaluation Count:60 | no Evaluation Count:0 |
| 0-60 |
876 | setWord1(&d, y << ((32-11) + k) | w >> (11 - k)); | - |
877 | goto ret_d; executed: goto ret_d; Execution Count:60 | 60 |
878 | } | - |
879 | z = xa > xa0 ? *--xa : 0; evaluated: xa > xa0 yes Evaluation Count:204 | yes Evaluation Count:2 |
| 2-204 |
880 | if (k -= 11) { evaluated: k -= 11 yes Evaluation Count:202 | yes Evaluation Count:4 |
| 4-202 |
881 | setWord0(&d, 0x3ff00000 | y << k | z >> (32 - k)); | - |
882 | y = xa > xa0 ? *--xa : 0; evaluated: xa > xa0 yes Evaluation Count:155 | yes Evaluation Count:47 |
| 47-155 |
883 | setWord1(&d, z << k | y >> (32 - k)); | - |
884 | } executed: } Execution Count:202 | 202 |
885 | else { | - |
886 | setWord0(&d, 0x3ff00000 | y); | - |
887 | setWord1(&d, z); | - |
888 | } executed: } Execution Count:4 | 4 |
889 | ret_d: | - |
890 | return d; executed: return d; Execution Count:266 | 266 |
891 | } | - |
892 | | - |
893 | static Bigint *d2b(double d, int *e, int *bits) | - |
894 | { | - |
895 | Bigint *b; | - |
896 | int de, i, k; | - |
897 | quint32 *x, y, z; | - |
898 | | - |
899 | | - |
900 | b = Balloc(1); | - |
901 | | - |
902 | | - |
903 | | - |
904 | x = b->x; | - |
905 | | - |
906 | z = getWord0(d) & 0xfffff; | - |
907 | setWord0(&d, getWord0(d) & 0x7fffffff); | - |
908 | | - |
909 | | - |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | if ((de = int(getWord0(d) >> 20)) != 0) evaluated: (de = int(getWord0(d) >> 20)) != 0 yes Evaluation Count:1463252 | yes Evaluation Count:12 |
| 12-1463252 |
915 | z |= 0x100000; executed: z |= 0x100000; Execution Count:1463252 | 1463252 |
916 | | - |
917 | | - |
918 | if ((y = getWord1(d)) != 0) { evaluated: (y = getWord1(d)) != 0 yes Evaluation Count:109936 | yes Evaluation Count:1353328 |
| 109936-1353328 |
919 | if ((k = lo0bits(&y)) != 0) { evaluated: (k = lo0bits(&y)) != 0 yes Evaluation Count:103173 | yes Evaluation Count:6763 |
| 6763-103173 |
920 | x[0] = y | z << (32 - k); | - |
921 | z >>= k; | - |
922 | } executed: } Execution Count:103173 | 103173 |
923 | else | - |
924 | x[0] = y; executed: x[0] = y; Execution Count:6763 | 6763 |
925 | i = b->wds = (x[1] = z) ? 2 : 1; evaluated: (x[1] = z) yes Evaluation Count:13398 | yes Evaluation Count:96538 |
| 13398-96538 |
926 | } executed: } Execution Count:109936 | 109936 |
927 | else { | - |
928 | | - |
929 | | - |
930 | | - |
931 | | - |
932 | k = lo0bits(&z); | - |
933 | x[0] = z; | - |
934 | i = b->wds = 1; | - |
935 | k += 32; | - |
936 | } executed: } Execution Count:1353328 | 1353328 |
937 | if (de) { evaluated: de yes Evaluation Count:1463252 | yes Evaluation Count:12 |
| 12-1463252 |
938 | | - |
939 | | - |
940 | | - |
941 | | - |
942 | | - |
943 | *e = de - 1023 - (53 -1) + k; | - |
944 | *bits = 53 - k; | - |
945 | | - |
946 | | - |
947 | } executed: } Execution Count:1463252 | 1463252 |
948 | else { | - |
949 | *e = de - 1023 - (53 -1) + 1 + k; | - |
950 | | - |
951 | *bits = 32*i - hi0bits(x[i-1]); | - |
952 | | - |
953 | | - |
954 | | - |
955 | } executed: } Execution Count:12 | 12 |
956 | | - |
957 | return b; executed: return b; Execution Count:1463264 | 1463264 |
958 | } | - |
959 | | - |
960 | static double ratio(Bigint *a, Bigint *b) | - |
961 | { | - |
962 | double da, db; | - |
963 | int k, ka, kb; | - |
964 | | - |
965 | da = b2d(a, &ka); | - |
966 | db = b2d(b, &kb); | - |
967 | | - |
968 | k = ka - kb + 32*(a->wds - b->wds); | - |
969 | if (k > 0) evaluated: k > 0 yes Evaluation Count:125 | yes Evaluation Count:8 |
| 8-125 |
970 | setWord0(&da, getWord0(da) + k*0x100000); executed: setWord0(&da, getWord0(da) + k*0x100000); Execution Count:125 | 125 |
971 | else { | - |
972 | k = -k; | - |
973 | setWord0(&db, getWord0(db) + k*0x100000); | - |
974 | } executed: } Execution Count:8 | 8 |
975 | | - |
976 | return da / db; executed: return da / db; Execution Count:133 | 133 |
977 | } | - |
978 | | - |
979 | static const double tens[] = { | - |
980 | 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, | - |
981 | 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, | - |
982 | 1e20, 1e21, 1e22 | - |
983 | | - |
984 | | - |
985 | | - |
986 | }; | - |
987 | | - |
988 | | - |
989 | static const double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; | - |
990 | static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }; | - |
991 | static double g_double_zero = 0.0; | - |
992 | | - |
993 | __attribute__((visibility("default"))) double qstrtod(const char *s00, const char **se, bool *ok) | - |
994 | { | - |
995 | int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, | - |
996 | e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; | - |
997 | const char *s, *s0, *s1; | - |
998 | double aadj, aadj1, adj, rv, rv0; | - |
999 | qint32 L; | - |
1000 | quint32 y, z; | - |
1001 | Bigint *bb1, *bd0; | - |
1002 | Bigint *bb = __null, *bd = __null, *bs = __null, *delta = __null; | - |
1003 | | - |
1004 | | - |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | | - |
1009 | | - |
1010 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:4149 | no Evaluation Count:0 |
| 0-4149 |
1011 | *ok = true; executed: *ok = true; Execution Count:4149 | 4149 |
1012 | | - |
1013 | const char decimal_point = '.'; | - |
1014 | | - |
1015 | sign = nz0 = nz = 0; | - |
1016 | rv = 0.; | - |
1017 | | - |
1018 | | - |
1019 | for(s = s00; isspace(uchar(*s)); s++) partially evaluated: isspace(uchar(*s)) no Evaluation Count:0 | yes Evaluation Count:4149 |
| 0-4149 |
1020 | ; | 0 |
1021 | | - |
1022 | if (*s == '-') { evaluated: *s == '-' yes Evaluation Count:411 | yes Evaluation Count:3738 |
| 411-3738 |
1023 | sign = 1; | - |
1024 | s++; | - |
1025 | } else if (*s == '+') { executed: } Execution Count:411 evaluated: *s == '+' yes Evaluation Count:7 | yes Evaluation Count:3731 |
| 7-3731 |
1026 | s++; | - |
1027 | } executed: } Execution Count:7 | 7 |
1028 | | - |
1029 | if (*s == '\0') { evaluated: *s == '\0' yes Evaluation Count:8 | yes Evaluation Count:4141 |
| 8-4141 |
1030 | s = s00; | - |
1031 | goto ret; executed: goto ret; Execution Count:8 | 8 |
1032 | } | - |
1033 | | - |
1034 | if (*s == '0') { evaluated: *s == '0' yes Evaluation Count:1529 | yes Evaluation Count:2612 |
| 1529-2612 |
1035 | nz0 = 1; | - |
1036 | while(*++s == '0') ; executed: ; Execution Count:81 evaluated: *++s == '0' yes Evaluation Count:81 | yes Evaluation Count:1529 |
| 81-1529 |
1037 | if (!*s) evaluated: !*s yes Evaluation Count:739 | yes Evaluation Count:790 |
| 739-790 |
1038 | goto ret; executed: goto ret; Execution Count:739 | 739 |
1039 | } executed: } Execution Count:790 | 790 |
1040 | s0 = s; | - |
1041 | y = z = 0; | - |
1042 | for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) evaluated: (c = *s) >= '0' yes Evaluation Count:26429 | yes Evaluation Count:3065 |
evaluated: c <= '9' yes Evaluation Count:26092 | yes Evaluation Count:337 |
| 337-26429 |
1043 | if (nd < 9) evaluated: nd < 9 yes Evaluation Count:7607 | yes Evaluation Count:18485 |
| 7607-18485 |
1044 | y = 10*y + c - '0'; executed: y = 10*y + c - '0'; Execution Count:7607 | 7607 |
1045 | else if (nd < 16) evaluated: nd < 16 yes Evaluation Count:1464 | yes Evaluation Count:17021 |
| 1464-17021 |
1046 | z = 10*z + c - '0'; executed: z = 10*z + c - '0'; Execution Count:1464 | 1464 |
1047 | nd0 = nd; | - |
1048 | if (c == decimal_point) { evaluated: c == decimal_point yes Evaluation Count:1804 | yes Evaluation Count:1598 |
| 1598-1804 |
1049 | c = *++s; | - |
1050 | if (!nd) { evaluated: !nd yes Evaluation Count:809 | yes Evaluation Count:995 |
| 809-995 |
1051 | for(; c == '0'; c = *++s) evaluated: c == '0' yes Evaluation Count:3382 | yes Evaluation Count:809 |
| 809-3382 |
1052 | nz++; executed: nz++; Execution Count:3382 | 3382 |
1053 | if (c > '0' && c <= '9') { evaluated: c > '0' yes Evaluation Count:263 | yes Evaluation Count:546 |
evaluated: c <= '9' yes Evaluation Count:260 | yes Evaluation Count:3 |
| 3-546 |
1054 | s0 = s; | - |
1055 | nf += nz; | - |
1056 | nz = 0; | - |
1057 | goto have_dig; executed: goto have_dig; Execution Count:260 | 260 |
1058 | } | - |
1059 | goto dig_done; executed: goto dig_done; Execution Count:549 | 549 |
1060 | } | - |
1061 | for(; c >= '0' && c <= '9'; c = *++s) { evaluated: c >= '0' yes Evaluation Count:7102 | yes Evaluation Count:1213 |
evaluated: c <= '9' yes Evaluation Count:7060 | yes Evaluation Count:42 |
| 42-7102 |
1062 | have_dig: | - |
1063 | nz++; | - |
1064 | if (c -= '0') { evaluated: c -= '0' yes Evaluation Count:3043 | yes Evaluation Count:4277 |
| 3043-4277 |
1065 | nf += nz; | - |
1066 | for(i = 1; i < nz; i++) evaluated: i < nz yes Evaluation Count:101 | yes Evaluation Count:3043 |
| 101-3043 |
1067 | if (nd++ < 9) evaluated: nd++ < 9 yes Evaluation Count:56 | yes Evaluation Count:45 |
| 45-56 |
1068 | y *= 10; executed: y *= 10; Execution Count:56 | 56 |
1069 | else if (nd <= 15 + 1) evaluated: nd <= 15 + 1 yes Evaluation Count:15 | yes Evaluation Count:30 |
| 15-30 |
1070 | z *= 10; executed: z *= 10; Execution Count:15 | 15 |
1071 | if (nd++ < 9) evaluated: nd++ < 9 yes Evaluation Count:1729 | yes Evaluation Count:1314 |
| 1314-1729 |
1072 | y = 10*y + c; executed: y = 10*y + c; Execution Count:1729 | 1729 |
1073 | else if (nd <= 15 + 1) evaluated: nd <= 15 + 1 yes Evaluation Count:640 | yes Evaluation Count:674 |
| 640-674 |
1074 | z = 10*z + c; executed: z = 10*z + c; Execution Count:640 | 640 |
1075 | nz = 0; | - |
1076 | } executed: } Execution Count:3043 | 3043 |
1077 | } executed: } Execution Count:7320 | 7320 |
1078 | } executed: } Execution Count:1255 | 1255 |
1079 | dig_done: code before this statement executed: dig_done: Execution Count:2853 | 2853 |
1080 | e = 0; | - |
1081 | if (c == 'e' || c == 'E') { evaluated: c == 'e' yes Evaluation Count:147 | yes Evaluation Count:3255 |
evaluated: c == 'E' yes Evaluation Count:10 | yes Evaluation Count:3245 |
| 10-3255 |
1082 | if (!nd && !nz && !nz0) { evaluated: !nd yes Evaluation Count:20 | yes Evaluation Count:137 |
partially evaluated: !nz yes Evaluation Count:20 | no Evaluation Count:0 |
partially evaluated: !nz0 yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-137 |
1083 | s = s00; | - |
1084 | goto ret; executed: goto ret; Execution Count:20 | 20 |
1085 | } | - |
1086 | s00 = s; | - |
1087 | esign = 0; | - |
1088 | switch(c = *++s) { | - |
1089 | case '-': | - |
1090 | esign = 1; | - |
1091 | case '+': code before this statement executed: case '+': Execution Count:42 | 42 |
1092 | c = *++s; | - |
1093 | } executed: } Execution Count:88 | 88 |
1094 | if (c >= '0' && c <= '9') { evaluated: c >= '0' yes Evaluation Count:112 | yes Evaluation Count:25 |
evaluated: c <= '9' yes Evaluation Count:111 | yes Evaluation Count:1 |
| 1-112 |
1095 | while(c == '0') evaluated: c == '0' yes Evaluation Count:34 | yes Evaluation Count:111 |
| 34-111 |
1096 | c = *++s; executed: c = *++s; Execution Count:34 | 34 |
1097 | if (c > '0' && c <= '9') { evaluated: c > '0' yes Evaluation Count:99 | yes Evaluation Count:12 |
partially evaluated: c <= '9' yes Evaluation Count:99 | no Evaluation Count:0 |
| 0-99 |
1098 | L = c - '0'; | - |
1099 | s1 = s; | - |
1100 | while((c = *++s) >= '0' && c <= '9') evaluated: (c = *++s) >= '0' yes Evaluation Count:74 | yes Evaluation Count:99 |
partially evaluated: c <= '9' yes Evaluation Count:74 | no Evaluation Count:0 |
| 0-99 |
1101 | L = 10*L + c - '0'; executed: L = 10*L + c - '0'; Execution Count:74 | 74 |
1102 | if (s - s1 > 8 || L > 19999) partially evaluated: s - s1 > 8 no Evaluation Count:0 | yes Evaluation Count:99 |
partially evaluated: L > 19999 no Evaluation Count:0 | yes Evaluation Count:99 |
| 0-99 |
1103 | | - |
1104 | | - |
1105 | | - |
1106 | e = 19999; never executed: e = 19999; | 0 |
1107 | else | - |
1108 | e = int(L); executed: e = int(L); Execution Count:99 | 99 |
1109 | if (esign) evaluated: esign yes Evaluation Count:31 | yes Evaluation Count:68 |
| 31-68 |
1110 | e = -e; executed: e = -e; Execution Count:31 | 31 |
1111 | } executed: } Execution Count:99 | 99 |
1112 | else | - |
1113 | e = 0; executed: e = 0; Execution Count:12 | 12 |
1114 | } | - |
1115 | else | - |
1116 | s = s00; executed: s = s00; Execution Count:26 | 26 |
1117 | } | - |
1118 | if (!nd) { evaluated: !nd yes Evaluation Count:770 | yes Evaluation Count:2612 |
| 770-2612 |
1119 | if (!nz && !nz0) evaluated: !nz yes Evaluation Count:307 | yes Evaluation Count:463 |
evaluated: !nz0 yes Evaluation Count:225 | yes Evaluation Count:82 |
| 82-463 |
1120 | s = s00; executed: s = s00; Execution Count:225 | 225 |
1121 | goto ret; executed: goto ret; Execution Count:770 | 770 |
1122 | } | - |
1123 | e1 = e -= nf; | - |
1124 | | - |
1125 | | - |
1126 | | - |
1127 | | - |
1128 | | - |
1129 | | - |
1130 | if (!nd0) evaluated: !nd0 yes Evaluation Count:260 | yes Evaluation Count:2352 |
| 260-2352 |
1131 | nd0 = nd; executed: nd0 = nd; Execution Count:260 | 260 |
1132 | k = nd < 15 + 1 ? nd : 15 + 1; evaluated: nd < 15 + 1 yes Evaluation Count:2463 | yes Evaluation Count:149 |
| 149-2463 |
1133 | rv = y; | - |
1134 | if (k > 9) evaluated: k > 9 yes Evaluation Count:488 | yes Evaluation Count:2124 |
| 488-2124 |
1135 | | - |
1136 | | - |
1137 | | - |
1138 | | - |
1139 | | - |
1140 | | - |
1141 | | - |
1142 | rv = tens[k - 9] * rv + z; executed: rv = tens[k - 9] * rv + z; Execution Count:488 | 488 |
1143 | | - |
1144 | | - |
1145 | bd0 = 0; | - |
1146 | if (nd <= 15 evaluated: nd <= 15 yes Evaluation Count:2463 | yes Evaluation Count:149 |
| 149-2463 |
1147 | | - |
1148 | && 1 == 1 partially evaluated: 1 == 1 yes Evaluation Count:2463 | no Evaluation Count:0 |
| 0-2463 |
1149 | | - |
1150 | ) { | - |
1151 | if (!e) evaluated: !e yes Evaluation Count:1945 | yes Evaluation Count:518 |
| 518-1945 |
1152 | goto ret; executed: goto ret; Execution Count:1945 | 1945 |
1153 | if (e > 0) { evaluated: e > 0 yes Evaluation Count:55 | yes Evaluation Count:463 |
| 55-463 |
1154 | if (e <= 22) { evaluated: e <= 22 yes Evaluation Count:39 | yes Evaluation Count:16 |
| 16-39 |
1155 | | - |
1156 | | - |
1157 | | - |
1158 | rv *= tens[e]; | - |
1159 | goto ret; executed: goto ret; Execution Count:39 | 39 |
1160 | | - |
1161 | } | - |
1162 | i = 15 - nd; | - |
1163 | if (e <= 22 + i) { evaluated: e <= 22 + i yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
1164 | | - |
1165 | | - |
1166 | | - |
1167 | e -= i; | - |
1168 | rv *= tens[i]; | - |
1169 | rv *= tens[e]; | - |
1170 | | - |
1171 | goto ret; executed: goto ret; Execution Count:4 | 4 |
1172 | } | - |
1173 | } executed: } Execution Count:12 | 12 |
1174 | | - |
1175 | else if (e >= -22) { evaluated: e >= -22 yes Evaluation Count:459 | yes Evaluation Count:4 |
| 4-459 |
1176 | rv /= tens[-e]; | - |
1177 | goto ret; executed: goto ret; Execution Count:459 | 459 |
1178 | } | - |
1179 | | - |
1180 | } | - |
1181 | e1 += nd - k; | - |
1182 | | - |
1183 | | - |
1184 | | - |
1185 | if (e1 > 0) { evaluated: e1 > 0 yes Evaluation Count:78 | yes Evaluation Count:87 |
| 78-87 |
1186 | if ((i = e1 & 15) != 0) evaluated: (i = e1 & 15) != 0 yes Evaluation Count:77 | yes Evaluation Count:1 |
| 1-77 |
1187 | rv *= tens[i]; executed: rv *= tens[i]; Execution Count:77 | 77 |
1188 | if (e1 &= ~15) { evaluated: e1 &= ~15 yes Evaluation Count:77 | yes Evaluation Count:1 |
| 1-77 |
1189 | if (e1 > 308) { evaluated: e1 > 308 yes Evaluation Count:2 | yes Evaluation Count:75 |
| 2-75 |
1190 | ovfl: | - |
1191 | | - |
1192 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1193 | *ok = false; executed: *ok = false; Execution Count:2 | 2 |
1194 | | - |
1195 | rv = (__builtin_huge_val()); | - |
1196 | if (bd0) partially evaluated: bd0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1197 | goto retfree; never executed: goto retfree; | 0 |
1198 | goto ret; executed: goto ret; Execution Count:2 | 2 |
1199 | } | - |
1200 | if (e1 >>= 4) { partially evaluated: e1 >>= 4 yes Evaluation Count:75 | no Evaluation Count:0 |
| 0-75 |
1201 | for(j = 0; e1 > 1; j++, e1 >>= 1) evaluated: e1 > 1 yes Evaluation Count:264 | yes Evaluation Count:75 |
| 75-264 |
1202 | if (e1 & 1) evaluated: e1 & 1 yes Evaluation Count:70 | yes Evaluation Count:194 |
| 70-194 |
1203 | rv *= bigtens[j]; executed: rv *= bigtens[j]; Execution Count:70 | 70 |
1204 | | - |
1205 | setWord0(&rv, getWord0(rv) - 53*0x100000); | - |
1206 | rv *= bigtens[j]; | - |
1207 | if ((z = getWord0(rv) & 0x7ff00000) | 0-75 |
1208 | > 0x100000*(1024 +1023 -53)) partially evaluated: (z = getWord0(rv) & 0x7ff00000) > 0x100000*(1024 +1023 -53) no Evaluation Count:0 | yes Evaluation Count:75 |
| 0-75 |
1209 | goto ovfl; never executed: goto ovfl; | 0 |
1210 | if (z > 0x100000*(1024 +1023 -1-53)) { partially evaluated: z > 0x100000*(1024 +1023 -1-53) no Evaluation Count:0 | yes Evaluation Count:75 |
| 0-75 |
1211 | | - |
1212 | | - |
1213 | setWord0(&rv, (0xfffff | 0x100000*(1024 +1023 -1))); | - |
1214 | setWord1(&rv, 0xffffffff); | - |
1215 | } | 0 |
1216 | else | - |
1217 | setWord0(&rv, getWord0(rv) + 53*0x100000); executed: setWord0(&rv, getWord0(rv) + 53*0x100000); Execution Count:75 | 75 |
1218 | } | - |
1219 | | - |
1220 | } executed: } Execution Count:75 | 75 |
1221 | } executed: } Execution Count:76 | 76 |
1222 | else if (e1 < 0) { partially evaluated: e1 < 0 yes Evaluation Count:87 | no Evaluation Count:0 |
| 0-87 |
1223 | e1 = -e1; | - |
1224 | if ((i = e1 & 15) != 0) evaluated: (i = e1 & 15) != 0 yes Evaluation Count:24 | yes Evaluation Count:63 |
| 24-63 |
1225 | rv /= tens[i]; executed: rv /= tens[i]; Execution Count:24 | 24 |
1226 | if (e1 &= ~15) { evaluated: e1 &= ~15 yes Evaluation Count:68 | yes Evaluation Count:19 |
| 19-68 |
1227 | e1 >>= 4; | - |
1228 | if (e1 >= 1 << 5) evaluated: e1 >= 1 << 5 yes Evaluation Count:2 | yes Evaluation Count:66 |
| 2-66 |
1229 | goto undfl; executed: goto undfl; Execution Count:2 | 2 |
1230 | for(j = 0; e1 > 1; j++, e1 >>= 1) evaluated: e1 > 1 yes Evaluation Count:8 | yes Evaluation Count:66 |
| 8-66 |
1231 | if (e1 & 1) evaluated: e1 & 1 yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
1232 | rv *= tinytens[j]; executed: rv *= tinytens[j]; Execution Count:4 | 4 |
1233 | | - |
1234 | rv0 = rv; | - |
1235 | rv *= tinytens[j]; | - |
1236 | if (rv == g_double_zero) partially evaluated: rv == g_double_zero no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
1237 | { | - |
1238 | rv = 2.*rv0; | - |
1239 | rv *= tinytens[j]; | - |
1240 | if (rv == g_double_zero) never evaluated: rv == g_double_zero | 0 |
1241 | { | - |
1242 | undfl: | - |
1243 | rv = 0.; | - |
1244 | | - |
1245 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1246 | *ok = false; executed: *ok = false; Execution Count:2 | 2 |
1247 | if (bd0) partially evaluated: bd0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1248 | goto retfree; never executed: goto retfree; | 0 |
1249 | goto ret; executed: goto ret; Execution Count:2 | 2 |
1250 | } | - |
1251 | setWord0(&rv, 0); | - |
1252 | setWord1(&rv, 1); | - |
1253 | | - |
1254 | | - |
1255 | | - |
1256 | } | 0 |
1257 | } executed: } Execution Count:66 | 66 |
1258 | } executed: } Execution Count:85 | 85 |
1259 | | - |
1260 | | - |
1261 | | - |
1262 | | - |
1263 | | - |
1264 | bd0 = s2b(s0, nd0, nd, y); | - |
1265 | | - |
1266 | for(;;) { | - |
1267 | bd = Balloc(bd0->k); | - |
1268 | memcpy(reinterpret_cast<char *>(&bd->sign), reinterpret_cast<char *>(&bd0->sign), bd0->wds*sizeof(qint32) + 2*sizeof(int)); | - |
1269 | bb = d2b(rv, &bbe, &bbbits); | - |
1270 | bs = i2b(1); | - |
1271 | | - |
1272 | if (e >= 0) { evaluated: e >= 0 yes Evaluation Count:76 | yes Evaluation Count:87 |
| 76-87 |
1273 | bb2 = bb5 = 0; | - |
1274 | bd2 = bd5 = e; | - |
1275 | } executed: } Execution Count:76 | 76 |
1276 | else { | - |
1277 | bb2 = bb5 = -e; | - |
1278 | bd2 = bd5 = 0; | - |
1279 | } executed: } Execution Count:87 | 87 |
1280 | if (bbe >= 0) evaluated: bbe >= 0 yes Evaluation Count:78 | yes Evaluation Count:85 |
| 78-85 |
1281 | bb2 += bbe; executed: bb2 += bbe; Execution Count:78 | 78 |
1282 | else | - |
1283 | bd2 -= bbe; executed: bd2 -= bbe; Execution Count:85 | 85 |
1284 | bs2 = bb2; | - |
1285 | | - |
1286 | | - |
1287 | | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | i = bbe + bbbits - 1; | - |
1293 | if (i < (-1022)) evaluated: i < (-1022) yes Evaluation Count:2 | yes Evaluation Count:161 |
| 2-161 |
1294 | j = bbe + (53 -(-1022)); executed: j = bbe + (53 -(-1022)); Execution Count:2 | 2 |
1295 | else | - |
1296 | j = 53 + 1 - bbbits; executed: j = 53 + 1 - bbbits; Execution Count:161 | 161 |
1297 | | - |
1298 | bb2 += j; | - |
1299 | bd2 += j; | - |
1300 | i = bb2 < bd2 ? bb2 : bd2; evaluated: bb2 < bd2 yes Evaluation Count:83 | yes Evaluation Count:80 |
| 80-83 |
1301 | if (i > bs2) evaluated: i > bs2 yes Evaluation Count:87 | yes Evaluation Count:76 |
| 76-87 |
1302 | i = bs2; executed: i = bs2; Execution Count:87 | 87 |
1303 | if (i > 0) { partially evaluated: i > 0 yes Evaluation Count:163 | no Evaluation Count:0 |
| 0-163 |
1304 | bb2 -= i; | - |
1305 | bd2 -= i; | - |
1306 | bs2 -= i; | - |
1307 | } executed: } Execution Count:163 | 163 |
1308 | if (bb5 > 0) { evaluated: bb5 > 0 yes Evaluation Count:87 | yes Evaluation Count:76 |
| 76-87 |
1309 | bs = pow5mult(bs, bb5); | - |
1310 | bb1 = mult(bs, bb); | - |
1311 | Bfree(bb); | - |
1312 | bb = bb1; | - |
1313 | } executed: } Execution Count:87 | 87 |
1314 | if (bb2 > 0) partially evaluated: bb2 > 0 yes Evaluation Count:163 | no Evaluation Count:0 |
| 0-163 |
1315 | bb = lshift(bb, bb2); executed: bb = lshift(bb, bb2); Execution Count:163 | 163 |
1316 | if (bd5 > 0) evaluated: bd5 > 0 yes Evaluation Count:16 | yes Evaluation Count:147 |
| 16-147 |
1317 | bd = pow5mult(bd, bd5); executed: bd = pow5mult(bd, bd5); Execution Count:16 | 16 |
1318 | if (bd2 > 0) evaluated: bd2 > 0 yes Evaluation Count:87 | yes Evaluation Count:76 |
| 76-87 |
1319 | bd = lshift(bd, bd2); executed: bd = lshift(bd, bd2); Execution Count:87 | 87 |
1320 | if (bs2 > 0) evaluated: bs2 > 0 yes Evaluation Count:76 | yes Evaluation Count:87 |
| 76-87 |
1321 | bs = lshift(bs, bs2); executed: bs = lshift(bs, bs2); Execution Count:76 | 76 |
1322 | delta = diff(bb, bd); | - |
1323 | dsign = delta->sign; | - |
1324 | delta->sign = 0; | - |
1325 | i = cmp(delta, bs); | - |
1326 | if (i < 0) { evaluated: i < 0 yes Evaluation Count:30 | yes Evaluation Count:133 |
| 30-133 |
1327 | | - |
1328 | | - |
1329 | | - |
1330 | if (dsign || getWord1(rv) || getWord0(rv) & 0xfffff) evaluated: dsign yes Evaluation Count:10 | yes Evaluation Count:20 |
evaluated: getWord1(rv) yes Evaluation Count:17 | yes Evaluation Count:3 |
partially evaluated: getWord0(rv) & 0xfffff no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-20 |
1331 | break; executed: break; Execution Count:27 | 27 |
1332 | delta = lshift(delta,1); | - |
1333 | if (cmp(delta, bs) > 0) evaluated: cmp(delta, bs) > 0 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
1334 | goto drop_down; executed: goto drop_down; Execution Count:1 | 1 |
1335 | break; executed: break; Execution Count:2 | 2 |
1336 | } | - |
1337 | if (i == 0) { partially evaluated: i == 0 no Evaluation Count:0 | yes Evaluation Count:133 |
| 0-133 |
1338 | | - |
1339 | if (dsign) { | 0 |
1340 | if ((getWord0(rv) & 0xfffff) == 0xfffff never evaluated: (getWord0(rv) & 0xfffff) == 0xfffff | 0 |
1341 | && getWord1(rv) == 0xffffffff) { never evaluated: getWord1(rv) == 0xffffffff | 0 |
1342 | | - |
1343 | setWord0(&rv, (getWord0(rv) & 0x7ff00000) | - |
1344 | + 0x100000 | - |
1345 | | - |
1346 | | - |
1347 | | - |
1348 | ); | - |
1349 | setWord1(&rv, 0); | - |
1350 | break; | 0 |
1351 | } | - |
1352 | } | 0 |
1353 | else if (!(getWord0(rv) & 0xfffff) && !getWord1(rv)) { never evaluated: !(getWord0(rv) & 0xfffff) never evaluated: !getWord1(rv) | 0 |
1354 | drop_down: | - |
1355 | L = (getWord0(rv) & 0x7ff00000) - 0x100000; | - |
1356 | | - |
1357 | setWord0(&rv, L | 0xfffff); | - |
1358 | setWord1(&rv, 0xffffffff); | - |
1359 | | - |
1360 | | - |
1361 | | - |
1362 | break; executed: break; Execution Count:1 | 1 |
1363 | | - |
1364 | } | - |
1365 | | - |
1366 | if (!(getWord1(rv) & 1)) never evaluated: !(getWord1(rv) & 1) | 0 |
1367 | break; | 0 |
1368 | | - |
1369 | if (dsign) | 0 |
1370 | rv += ulp(rv); never executed: rv += ulp(rv); | 0 |
1371 | | - |
1372 | else { | - |
1373 | rv -= ulp(rv); | - |
1374 | | - |
1375 | if (rv == g_double_zero) never evaluated: rv == g_double_zero | 0 |
1376 | goto undfl; never executed: goto undfl; | 0 |
1377 | | - |
1378 | } | 0 |
1379 | | - |
1380 | break; | 0 |
1381 | } | - |
1382 | if ((aadj = ratio(delta, bs)) <= 2.) { evaluated: (aadj = ratio(delta, bs)) <= 2. yes Evaluation Count:15 | yes Evaluation Count:118 |
| 15-118 |
1383 | if (dsign) evaluated: dsign yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-11 |
1384 | aadj = aadj1 = 1.; executed: aadj = aadj1 = 1.; Execution Count:11 | 11 |
1385 | else if (getWord1(rv) || getWord0(rv) & 0xfffff) { partially evaluated: getWord1(rv) yes Evaluation Count:4 | no Evaluation Count:0 |
never evaluated: getWord0(rv) & 0xfffff | 0-4 |
1386 | | - |
1387 | if (getWord1(rv) == 1 && !getWord0(rv)) partially evaluated: getWord1(rv) == 1 no Evaluation Count:0 | yes Evaluation Count:4 |
never evaluated: !getWord0(rv) | 0-4 |
1388 | goto undfl; never executed: goto undfl; | 0 |
1389 | | - |
1390 | aadj = 1.; | - |
1391 | aadj1 = -1.; | - |
1392 | } executed: } Execution Count:4 | 4 |
1393 | else { | - |
1394 | | - |
1395 | | - |
1396 | | - |
1397 | if (aadj < 2./2) never evaluated: aadj < 2./2 | 0 |
1398 | aadj = 1./2; never executed: aadj = 1./2; | 0 |
1399 | else | - |
1400 | aadj *= 0.5; never executed: aadj *= 0.5; | 0 |
1401 | aadj1 = -aadj; | - |
1402 | } | 0 |
1403 | } | - |
1404 | else { | - |
1405 | aadj *= 0.5; | - |
1406 | aadj1 = dsign ? aadj : -aadj; partially evaluated: dsign yes Evaluation Count:118 | no Evaluation Count:0 |
| 0-118 |
1407 | if (1 == 0) partially evaluated: 1 == 0 no Evaluation Count:0 | yes Evaluation Count:118 |
| 0-118 |
1408 | aadj1 += 0.5; never executed: aadj1 += 0.5; | 0 |
1409 | | - |
1410 | } executed: } Execution Count:118 | 118 |
1411 | y = getWord0(rv) & 0x7ff00000; | - |
1412 | | - |
1413 | | - |
1414 | | - |
1415 | if (y == 0x100000*(1024 +1023 -1)) { evaluated: y == 0x100000*(1024 +1023 -1) yes Evaluation Count:62 | yes Evaluation Count:71 |
| 62-71 |
1416 | rv0 = rv; | - |
1417 | setWord0(&rv, getWord0(rv) - 53*0x100000); | - |
1418 | adj = aadj1 * ulp(rv); | - |
1419 | rv += adj; | - |
1420 | if ((getWord0(rv) & 0x7ff00000) >= | 0-62 |
1421 | 0x100000*(1024 +1023 -53)) { partially evaluated: (getWord0(rv) & 0x7ff00000) >= 0x100000*(1024 +1023 -53) no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
1422 | if (getWord0(rv0) == (0xfffff | 0x100000*(1024 +1023 -1)) && getWord1(rv0) == 0xffffffff) never evaluated: getWord0(rv0) == (0xfffff | 0x100000*(1024 +1023 -1)) never evaluated: getWord1(rv0) == 0xffffffff | 0 |
1423 | goto ovfl; never executed: goto ovfl; | 0 |
1424 | setWord0(&rv, (0xfffff | 0x100000*(1024 +1023 -1))); | - |
1425 | setWord1(&rv, 0xffffffff); | - |
1426 | goto cont; never executed: goto cont; | 0 |
1427 | } | - |
1428 | else | - |
1429 | setWord0(&rv, getWord0(rv) + 53*0x100000); executed: setWord0(&rv, getWord0(rv) + 53*0x100000); Execution Count:62 | 62 |
1430 | } | - |
1431 | else { | - |
1432 | if (y <= (53 -1)*0x100000 && aadj >= 1.) { partially evaluated: y <= (53 -1)*0x100000 no Evaluation Count:0 | yes Evaluation Count:71 |
never evaluated: aadj >= 1. | 0-71 |
1433 | aadj1 = int(aadj + 0.5); | - |
1434 | if (!dsign) | 0 |
1435 | aadj1 = -aadj1; never executed: aadj1 = -aadj1; | 0 |
1436 | } | 0 |
1437 | adj = aadj1 * ulp(rv); | - |
1438 | rv += adj; | - |
1439 | | - |
1440 | } executed: } Execution Count:71 | 71 |
1441 | z = getWord0(rv) & 0x7ff00000; | - |
1442 | if (y == z) { evaluated: y == z yes Evaluation Count:131 | yes Evaluation Count:2 |
| 2-131 |
1443 | | - |
1444 | L = qint32(aadj); | - |
1445 | aadj -= L; | - |
1446 | | - |
1447 | if (dsign || getWord1(rv) || getWord0(rv) & 0xfffff) { evaluated: dsign yes Evaluation Count:127 | yes Evaluation Count:4 |
partially evaluated: getWord1(rv) yes Evaluation Count:4 | no Evaluation Count:0 |
never evaluated: getWord0(rv) & 0xfffff | 0-127 |
1448 | if (aadj < .4999999 || aadj > .5000001) evaluated: aadj < .4999999 yes Evaluation Count:119 | yes Evaluation Count:12 |
partially evaluated: aadj > .5000001 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-119 |
1449 | break; executed: break; Execution Count:131 | 131 |
1450 | } | 0 |
1451 | else if (aadj < .4999999/2) never evaluated: aadj < .4999999/2 | 0 |
1452 | break; | 0 |
1453 | } | - |
1454 | cont: code before this statement executed: cont: Execution Count:2 | 2 |
1455 | Bfree(bb); | - |
1456 | Bfree(bd); | - |
1457 | Bfree(bs); | - |
1458 | Bfree(delta); | - |
1459 | } executed: } Execution Count:2 | 2 |
1460 | retfree: code before this statement executed: retfree: Execution Count:161 | 161 |
1461 | Bfree(bb); | - |
1462 | Bfree(bd); | - |
1463 | Bfree(bs); | - |
1464 | Bfree(bd0); | - |
1465 | Bfree(delta); | - |
1466 | ret: code before this statement executed: ret: Execution Count:161 | 161 |
1467 | if (se) partially evaluated: se yes Evaluation Count:4149 | no Evaluation Count:0 |
| 0-4149 |
1468 | *se = s; executed: *se = s; Execution Count:4149 | 4149 |
1469 | return sign ? -rv : rv; executed: return sign ? -rv : rv; Execution Count:4149 | 4149 |
1470 | } | - |
1471 | | - |
1472 | static int quorem(Bigint *b, Bigint *S) | - |
1473 | { | - |
1474 | int n; | - |
1475 | qint32 borrow, y; | - |
1476 | quint32 carry, q, ys; | - |
1477 | quint32 *bx, *bxe, *sx, *sxe; | - |
1478 | | - |
1479 | qint32 z; | - |
1480 | quint32 si, zs; | - |
1481 | | - |
1482 | | - |
1483 | n = S->wds; | - |
1484 | | - |
1485 | | - |
1486 | | - |
1487 | | - |
1488 | if (b->wds < n) evaluated: b->wds < n yes Evaluation Count:3865 | yes Evaluation Count:120577 |
| 3865-120577 |
1489 | return 0; executed: return 0; Execution Count:3865 | 3865 |
1490 | sx = S->x; | - |
1491 | sxe = sx + --n; | - |
1492 | bx = b->x; | - |
1493 | bxe = bx + n; | - |
1494 | q = *bxe / (*sxe + 1); | - |
1495 | | - |
1496 | | - |
1497 | | - |
1498 | | - |
1499 | if (q) { evaluated: q yes Evaluation Count:110845 | yes Evaluation Count:9732 |
| 9732-110845 |
1500 | borrow = 0; | - |
1501 | carry = 0; | - |
1502 | do { | - |
1503 | | - |
1504 | si = *sx++; | - |
1505 | ys = (si & 0xffff) * q + carry; | - |
1506 | zs = (si >> 16) * q + (ys >> 16); | - |
1507 | carry = zs >> 16; | - |
1508 | y = (*bx & 0xffff) - (ys & 0xffff) + borrow; | - |
1509 | borrow = y >> 16; | - |
1510 | ; | - |
1511 | z = (*bx >> 16) - (zs & 0xffff) + borrow; | - |
1512 | borrow = z >> 16; | - |
1513 | ; | - |
1514 | Storeinc(bx, z, y); | - |
1515 | } executed: } Execution Count:899957 | 899957 |
1516 | while(sx <= sxe); evaluated: sx <= sxe yes Evaluation Count:789112 | yes Evaluation Count:110845 |
| 110845-789112 |
1517 | if (!*bxe) { partially evaluated: !*bxe no Evaluation Count:0 | yes Evaluation Count:110845 |
| 0-110845 |
1518 | bx = b->x; | - |
1519 | while(--bxe > bx && !*bxe) never evaluated: --bxe > bx | 0 |
1520 | --n; | 0 |
1521 | b->wds = n; | - |
1522 | } | 0 |
1523 | } executed: } Execution Count:110845 | 110845 |
1524 | if (cmp(b, S) >= 0) { evaluated: cmp(b, S) >= 0 yes Evaluation Count:582 | yes Evaluation Count:119995 |
| 582-119995 |
1525 | q++; | - |
1526 | borrow = 0; | - |
1527 | carry = 0; | - |
1528 | bx = b->x; | - |
1529 | sx = S->x; | - |
1530 | do { | - |
1531 | | - |
1532 | si = *sx++; | - |
1533 | ys = (si & 0xffff) + carry; | - |
1534 | zs = (si >> 16) + (ys >> 16); | - |
1535 | carry = zs >> 16; | - |
1536 | y = (*bx & 0xffff) - (ys & 0xffff) + borrow; | - |
1537 | borrow = y >> 16; | - |
1538 | ; | - |
1539 | z = (*bx >> 16) - (zs & 0xffff) + borrow; | - |
1540 | borrow = z >> 16; | - |
1541 | ; | - |
1542 | Storeinc(bx, z, y); | - |
1543 | } executed: } Execution Count:2767 | 2767 |
1544 | while(sx <= sxe); evaluated: sx <= sxe yes Evaluation Count:2185 | yes Evaluation Count:582 |
| 582-2185 |
1545 | bx = b->x; | - |
1546 | bxe = bx + n; | - |
1547 | if (!*bxe) { partially evaluated: !*bxe yes Evaluation Count:582 | no Evaluation Count:0 |
| 0-582 |
1548 | while(--bxe > bx && !*bxe) evaluated: --bxe > bx yes Evaluation Count:1603 | yes Evaluation Count:582 |
partially evaluated: !*bxe yes Evaluation Count:1603 | no Evaluation Count:0 |
| 0-1603 |
1549 | --n; executed: --n; Execution Count:1603 | 1603 |
1550 | b->wds = n; | - |
1551 | } executed: } Execution Count:582 | 582 |
1552 | } executed: } Execution Count:582 | 582 |
1553 | return q; executed: return q; Execution Count:120577 | 120577 |
1554 | } | - |
1555 | __attribute__((visibility("default"))) char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp) | - |
1556 | { | - |
1557 | fenv_t envp; | - |
1558 | feholdexcept(&envp); | - |
1559 | | - |
1560 | | - |
1561 | char *s = _qdtoa(d, mode, ndigits, decpt, sign, rve, resultp); | - |
1562 | fesetenv(&envp); | - |
1563 | | - |
1564 | | - |
1565 | return s; executed: return s; Execution Count:1505278 | 1505278 |
1566 | } | - |
1567 | | - |
1568 | static char *_qdtoa( volatile double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp) | - |
1569 | { | - |
1570 | int bbits, b2, b5, be, dig, i, ieps, ilim0, | - |
1571 | j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, | - |
1572 | try_quick; | - |
1573 | int ilim = 0, ilim1 = 0, spec_case = 0; | - |
1574 | qint32 L; | - |
1575 | | - |
1576 | int denorm; | - |
1577 | quint32 x; | - |
1578 | | - |
1579 | Bigint *b, *b1, *delta, *mhi, *S; | - |
1580 | Bigint *mlo = __null; | - |
1581 | double d2; | - |
1582 | double ds, eps; | - |
1583 | char *s, *s0; | - |
1584 | | - |
1585 | if (getWord0(d) & 0x80000000) { evaluated: getWord0(d) & 0x80000000 yes Evaluation Count:474215 | yes Evaluation Count:1031063 |
| 474215-1031063 |
1586 | | - |
1587 | *sign = 1; | - |
1588 | setWord0(&d, getWord0(d) & ~0x80000000); | - |
1589 | } executed: } Execution Count:474215 | 474215 |
1590 | else | - |
1591 | *sign = 0; executed: *sign = 0; Execution Count:1031063 | 1031063 |
1592 | | - |
1593 | | - |
1594 | | - |
1595 | if ((getWord0(d) & 0x7ff00000) == 0x7ff00000) partially evaluated: (getWord0(d) & 0x7ff00000) == 0x7ff00000 no Evaluation Count:0 | yes Evaluation Count:1505278 |
| 0-1505278 |
1596 | | - |
1597 | | - |
1598 | | - |
1599 | { | - |
1600 | | - |
1601 | *decpt = 9999; | - |
1602 | s = | - |
1603 | | - |
1604 | !getWord1(d) && !(getWord0(d) & 0xfffff) ? const_cast<char*>("Infinity") : never evaluated: !getWord1(d) never evaluated: !(getWord0(d) & 0xfffff) | 0 |
1605 | | - |
1606 | const_cast<char*>("NaN"); | - |
1607 | if (rve) | 0 |
1608 | *rve = | 0 |
1609 | | 0 |
1610 | s[3] ? s + 8 : | 0 |
1611 | | 0 |
1612 | s + 3; never executed: *rve = s[3] ? s + 8 : s + 3; | 0 |
1613 | return s; never executed: return s; | 0 |
1614 | } | - |
1615 | | - |
1616 | | - |
1617 | | - |
1618 | | - |
1619 | if (d == g_double_zero) evaluated: d == g_double_zero yes Evaluation Count:42177 | yes Evaluation Count:1463101 |
| 42177-1463101 |
1620 | { | - |
1621 | *decpt = 1; | - |
1622 | s = const_cast<char*>("0"); | - |
1623 | if (rve) partially evaluated: rve yes Evaluation Count:42177 | no Evaluation Count:0 |
| 0-42177 |
1624 | *rve = s + 1; executed: *rve = s + 1; Execution Count:42177 | 42177 |
1625 | return s; executed: return s; Execution Count:42177 | 42177 |
1626 | } | - |
1627 | | - |
1628 | b = d2b(d, &be, &bbits); | - |
1629 | | - |
1630 | | - |
1631 | | - |
1632 | if ((i = int(getWord0(d) >> 20 & (0x7ff00000>>20))) != 0) { evaluated: (i = int(getWord0(d) >> 20 & (0x7ff00000>>20))) != 0 yes Evaluation Count:1463091 | yes Evaluation Count:10 |
| 10-1463091 |
1633 | | - |
1634 | d2 = d; | - |
1635 | setWord0(&d2, getWord0(d2) & 0xfffff); | - |
1636 | setWord0(&d2, getWord0(d2) | 0x3ff00000); | - |
1637 | i -= 1023; | - |
1638 | | - |
1639 | | - |
1640 | | - |
1641 | | - |
1642 | | - |
1643 | denorm = 0; | - |
1644 | } executed: } Execution Count:1463091 | 1463091 |
1645 | else { | - |
1646 | | - |
1647 | | - |
1648 | i = bbits + be + (1023 + (53 -1) - 1); | - |
1649 | x = i > 32 ? getWord0(d) << (64 - i) | getWord1(d) >> (i - 32) partially evaluated: i > 32 yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1650 | : getWord1(d) << (32 - i); | - |
1651 | d2 = x; | - |
1652 | setWord0(&d2, getWord0(d2) - 31*0x100000); | - |
1653 | i -= (1023 + (53 -1) - 1) + 1; | - |
1654 | denorm = 1; | - |
1655 | } executed: } Execution Count:10 | 10 |
1656 | | - |
1657 | ds = (d2-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; | - |
1658 | k = int(ds); | - |
1659 | if (ds < 0. && ds != k) evaluated: ds < 0. yes Evaluation Count:49667 | yes Evaluation Count:1413434 |
partially evaluated: ds != k yes Evaluation Count:49667 | no Evaluation Count:0 |
| 0-1413434 |
1660 | k--; executed: k--; Execution Count:49667 | 49667 |
1661 | k_check = 1; | - |
1662 | if (k >= 0 && k <= 22) { evaluated: k >= 0 yes Evaluation Count:1413434 | yes Evaluation Count:49667 |
evaluated: k <= 22 yes Evaluation Count:1410332 | yes Evaluation Count:3102 |
| 3102-1413434 |
1663 | if (d < tens[k]) evaluated: d < tens[k] yes Evaluation Count:6950 | yes Evaluation Count:1403382 |
| 6950-1403382 |
1664 | k--; executed: k--; Execution Count:6950 | 6950 |
1665 | k_check = 0; | - |
1666 | } executed: } Execution Count:1410332 | 1410332 |
1667 | j = bbits - i - 1; | - |
1668 | if (j >= 0) { evaluated: j >= 0 yes Evaluation Count:662974 | yes Evaluation Count:800127 |
| 662974-800127 |
1669 | b2 = 0; | - |
1670 | s2 = j; | - |
1671 | } executed: } Execution Count:662974 | 662974 |
1672 | else { | - |
1673 | b2 = -j; | - |
1674 | s2 = 0; | - |
1675 | } executed: } Execution Count:800127 | 800127 |
1676 | if (k >= 0) { evaluated: k >= 0 yes Evaluation Count:1410310 | yes Evaluation Count:52791 |
| 52791-1410310 |
1677 | b5 = 0; | - |
1678 | s5 = k; | - |
1679 | s2 += k; | - |
1680 | } executed: } Execution Count:1410310 | 1410310 |
1681 | else { | - |
1682 | b2 -= k; | - |
1683 | b5 = -k; | - |
1684 | s5 = 0; | - |
1685 | } executed: } Execution Count:52791 | 52791 |
1686 | if (mode < 0 || mode > 9) partially evaluated: mode < 0 no Evaluation Count:0 | yes Evaluation Count:1463101 |
partially evaluated: mode > 9 no Evaluation Count:0 | yes Evaluation Count:1463101 |
| 0-1463101 |
1687 | mode = 0; never executed: mode = 0; | 0 |
1688 | try_quick = 1; | - |
1689 | if (mode > 5) { partially evaluated: mode > 5 no Evaluation Count:0 | yes Evaluation Count:1463101 |
| 0-1463101 |
1690 | mode -= 4; | - |
1691 | try_quick = 0; | - |
1692 | } | 0 |
1693 | leftright = 1; | - |
1694 | switch(mode) { | - |
1695 | case 0: | - |
1696 | case 1: | - |
1697 | ilim = ilim1 = -1; | - |
1698 | i = 18; | - |
1699 | ndigits = 0; | - |
1700 | break; | 0 |
1701 | case 2: | - |
1702 | leftright = 0; | - |
1703 | | - |
1704 | case 4: code before this statement executed: case 4: Execution Count:1461963 | 1461963 |
1705 | if (ndigits <= 0) evaluated: ndigits <= 0 yes Evaluation Count:1681 | yes Evaluation Count:1460282 |
| 1681-1460282 |
1706 | ndigits = 1; executed: ndigits = 1; Execution Count:1681 | 1681 |
1707 | ilim = ilim1 = i = ndigits; | - |
1708 | break; executed: break; Execution Count:1461963 | 1461963 |
1709 | case 3: | - |
1710 | leftright = 0; | - |
1711 | | - |
1712 | case 5: code before this statement executed: case 5: Execution Count:1138 | 1138 |
1713 | i = ndigits + k + 1; | - |
1714 | ilim = i; | - |
1715 | ilim1 = i - 1; | - |
1716 | if (i <= 0) evaluated: i <= 0 yes Evaluation Count:3 | yes Evaluation Count:1135 |
| 3-1135 |
1717 | i = 1; executed: i = 1; Execution Count:3 | 3 |
1718 | } executed: } Execution Count:1138 | 1138 |
1719 | try { | - |
1720 | *resultp = static_cast<char *>(malloc(i + 1)); | - |
1721 | do { if (!(*resultp)) qBadAlloc(); } while (0); never executed: qBadAlloc(); executed: } Execution Count:1463101 partially evaluated: !(*resultp) no Evaluation Count:0 | yes Evaluation Count:1463101 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1463101 |
| 0-1463101 |
1722 | } catch (...) { executed: } Execution Count:1463101 | 1463101 |
1723 | Bfree(b); | - |
1724 | throw; | 0 |
1725 | } | - |
1726 | s = s0 = *resultp; | - |
1727 | | - |
1728 | if (ilim >= 0 && ilim <= 14 && try_quick) { partially evaluated: ilim >= 0 yes Evaluation Count:1463101 | no Evaluation Count:0 |
evaluated: ilim <= 14 yes Evaluation Count:1460594 | yes Evaluation Count:2507 |
partially evaluated: try_quick yes Evaluation Count:1460594 | no Evaluation Count:0 |
| 0-1463101 |
1729 | | - |
1730 | | - |
1731 | | - |
1732 | i = 0; | - |
1733 | d2 = d; | - |
1734 | k0 = k; | - |
1735 | ilim0 = ilim; | - |
1736 | ieps = 2; | - |
1737 | if (k > 0) { evaluated: k > 0 yes Evaluation Count:1330446 | yes Evaluation Count:130148 |
| 130148-1330446 |
1738 | ds = tens[k&0xf]; | - |
1739 | j = k >> 4; | - |
1740 | if (j & 0x10) { evaluated: j & 0x10 yes Evaluation Count:223 | yes Evaluation Count:1330223 |
| 223-1330223 |
1741 | | - |
1742 | j &= 0x10 - 1; | - |
1743 | d /= bigtens[5 -1]; | - |
1744 | ieps++; | - |
1745 | } executed: } Execution Count:223 | 223 |
1746 | for(; j; j >>= 1, i++) evaluated: j yes Evaluation Count:6799 | yes Evaluation Count:1330446 |
| 6799-1330446 |
1747 | if (j & 1) { evaluated: j & 1 yes Evaluation Count:3639 | yes Evaluation Count:3160 |
| 3160-3639 |
1748 | ieps++; | - |
1749 | ds *= bigtens[i]; | - |
1750 | } executed: } Execution Count:3639 | 3639 |
1751 | d /= ds; | - |
1752 | } executed: } Execution Count:1330446 | 1330446 |
1753 | else if ((j1 = -k) != 0) { evaluated: (j1 = -k) != 0 yes Evaluation Count:51632 | yes Evaluation Count:78516 |
| 51632-78516 |
1754 | d *= tens[j1 & 0xf]; | - |
1755 | for(j = j1 >> 4; j; j >>= 1, i++) evaluated: j yes Evaluation Count:3890 | yes Evaluation Count:51632 |
| 3890-51632 |
1756 | if (j & 1) { evaluated: j & 1 yes Evaluation Count:2526 | yes Evaluation Count:1364 |
| 1364-2526 |
1757 | ieps++; | - |
1758 | d *= bigtens[i]; | - |
1759 | } executed: } Execution Count:2526 | 2526 |
1760 | } executed: } Execution Count:51632 | 51632 |
1761 | if (k_check && d < 1. && ilim > 0) { evaluated: k_check yes Evaluation Count:51221 | yes Evaluation Count:1409373 |
evaluated: d < 1. yes Evaluation Count:3920 | yes Evaluation Count:47301 |
partially evaluated: ilim > 0 yes Evaluation Count:3920 | no Evaluation Count:0 |
| 0-1409373 |
1762 | if (ilim1 <= 0) partially evaluated: ilim1 <= 0 no Evaluation Count:0 | yes Evaluation Count:3920 |
| 0-3920 |
1763 | goto fast_failed; never executed: goto fast_failed; | 0 |
1764 | ilim = ilim1; | - |
1765 | k--; | - |
1766 | d *= 10.; | - |
1767 | ieps++; | - |
1768 | } executed: } Execution Count:3920 | 3920 |
1769 | eps = ieps*d + 7.; | - |
1770 | setWord0(&eps, getWord0(eps) - (53 -1)*0x100000); | - |
1771 | if (ilim == 0) { evaluated: ilim == 0 yes Evaluation Count:3 | yes Evaluation Count:1460591 |
| 3-1460591 |
1772 | S = mhi = 0; | - |
1773 | d -= 5.; | - |
1774 | if (d > eps) partially evaluated: d > eps no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1775 | goto one_digit; never executed: goto one_digit; | 0 |
1776 | if (d < -eps) evaluated: d < -eps yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1777 | goto no_digits; executed: goto no_digits; Execution Count:2 | 2 |
1778 | goto fast_failed; executed: goto fast_failed; Execution Count:1 | 1 |
1779 | } | - |
1780 | | - |
1781 | if (leftright) { partially evaluated: leftright no Evaluation Count:0 | yes Evaluation Count:1460591 |
| 0-1460591 |
1782 | | - |
1783 | | - |
1784 | | - |
1785 | eps = 0.5/tens[ilim-1] - eps; | - |
1786 | for(i = 0;;) { | - |
1787 | L = qint32(d); | - |
1788 | d -= L; | - |
1789 | *s++ = '0' + int(L); | - |
1790 | if (d < eps) | 0 |
1791 | goto ret1; never executed: goto ret1; | 0 |
1792 | if (1. - d < eps) never evaluated: 1. - d < eps | 0 |
1793 | goto bump_up; never executed: goto bump_up; | 0 |
1794 | if (++i >= ilim) never evaluated: ++i >= ilim | 0 |
1795 | break; | 0 |
1796 | eps *= 10.; | - |
1797 | d *= 10.; | - |
1798 | } | 0 |
1799 | } | 0 |
1800 | else { | - |
1801 | | - |
1802 | | - |
1803 | | - |
1804 | | - |
1805 | | - |
1806 | | - |
1807 | | - |
1808 | eps *= tens[ilim-1]; | - |
1809 | | - |
1810 | for(i = 1;; i++, d *= 10.) { | - |
1811 | L = qint32(d); | - |
1812 | d -= L; | - |
1813 | *s++ = '0' + int(L); | - |
1814 | if (i == ilim) { evaluated: i == ilim yes Evaluation Count:1460591 | yes Evaluation Count:7279600 |
| 1460591-7279600 |
1815 | if (d > 0.5 + eps) evaluated: d > 0.5 + eps yes Evaluation Count:422158 | yes Evaluation Count:1038433 |
| 422158-1038433 |
1816 | goto bump_up; executed: goto bump_up; Execution Count:422158 | 422158 |
1817 | else if (d < 0.5 - eps) { evaluated: d < 0.5 - eps yes Evaluation Count:1038429 | yes Evaluation Count:4 |
| 4-1038429 |
1818 | while(*--s == '0') {} executed: } Execution Count:3900020 evaluated: *--s == '0' yes Evaluation Count:3900020 | yes Evaluation Count:1038429 |
| 1038429-3900020 |
1819 | s++; | - |
1820 | goto ret1; executed: goto ret1; Execution Count:1038429 | 1038429 |
1821 | } | - |
1822 | break; executed: break; Execution Count:4 | 4 |
1823 | } | - |
1824 | } executed: } Execution Count:7279600 | 7279600 |
1825 | | - |
1826 | } executed: } Execution Count:4 | 4 |
1827 | | - |
1828 | fast_failed: code before this statement executed: fast_failed: Execution Count:4 | 4 |
1829 | s = s0; | - |
1830 | d = d2; | - |
1831 | k = k0; | - |
1832 | ilim = ilim0; | - |
1833 | } executed: } Execution Count:5 | 5 |
1834 | | - |
1835 | | - |
1836 | | - |
1837 | if (be >= 0 && k <= 14) { evaluated: be >= 0 yes Evaluation Count:735 | yes Evaluation Count:1777 |
evaluated: k <= 14 yes Evaluation Count:282 | yes Evaluation Count:453 |
| 282-1777 |
1838 | | - |
1839 | ds = tens[k]; | - |
1840 | if (ndigits < 0 && ilim <= 0) { partially evaluated: ndigits < 0 no Evaluation Count:0 | yes Evaluation Count:282 |
never evaluated: ilim <= 0 | 0-282 |
1841 | S = mhi = 0; | - |
1842 | if (ilim < 0 || d <= 5*ds) never evaluated: ilim < 0 never evaluated: d <= 5*ds | 0 |
1843 | goto no_digits; never executed: goto no_digits; | 0 |
1844 | goto one_digit; never executed: goto one_digit; | 0 |
1845 | } | - |
1846 | for(i = 1;; i++) { | - |
1847 | L = qint32(d / ds); | - |
1848 | d -= L*ds; | - |
1849 | | - |
1850 | | - |
1851 | | - |
1852 | | - |
1853 | | - |
1854 | | - |
1855 | | - |
1856 | *s++ = '0' + int(L); | - |
1857 | if (i == ilim) { partially evaluated: i == ilim no Evaluation Count:0 | yes Evaluation Count:331 |
| 0-331 |
1858 | d += d; | - |
1859 | if (d > ds || (d == ds && L & 1)) { | 0 |
1860 | bump_up: | - |
1861 | while(*--s == '9') evaluated: *--s == '9' yes Evaluation Count:1233417 | yes Evaluation Count:418602 |
| 418602-1233417 |
1862 | if (s == s0) { evaluated: s == s0 yes Evaluation Count:3556 | yes Evaluation Count:1229861 |
| 3556-1229861 |
1863 | k++; | - |
1864 | *s = '0'; | - |
1865 | break; executed: break; Execution Count:3556 | 3556 |
1866 | } | - |
1867 | ++*s++; | - |
1868 | } executed: } Execution Count:422158 | 422158 |
1869 | break; executed: break; Execution Count:422158 | 422158 |
1870 | } | - |
1871 | if ((d *= 10.) == g_double_zero) evaluated: (d *= 10.) == g_double_zero yes Evaluation Count:282 | yes Evaluation Count:49 |
| 49-282 |
1872 | break; executed: break; Execution Count:282 | 282 |
1873 | } executed: } Execution Count:49 | 49 |
1874 | goto ret1; executed: goto ret1; Execution Count:422440 | 422440 |
1875 | } | - |
1876 | | - |
1877 | m2 = b2; | - |
1878 | m5 = b5; | - |
1879 | mhi = mlo = 0; | - |
1880 | if (leftright) { partially evaluated: leftright no Evaluation Count:0 | yes Evaluation Count:2230 |
| 0-2230 |
1881 | if (mode < 2) { never evaluated: mode < 2 | 0 |
1882 | i = | - |
1883 | | - |
1884 | denorm ? be + (1023 + (53 -1) - 1 + 1) : | 0 |
1885 | | - |
1886 | | - |
1887 | | - |
1888 | | - |
1889 | 1 + 53 - bbits; | - |
1890 | | - |
1891 | } | 0 |
1892 | else { | - |
1893 | j = ilim - 1; | - |
1894 | if (m5 >= j) | 0 |
1895 | m5 -= j; | 0 |
1896 | else { | - |
1897 | s5 += j -= m5; | - |
1898 | b5 += j; | - |
1899 | m5 = 0; | - |
1900 | } | 0 |
1901 | if ((i = ilim) < 0) { never evaluated: (i = ilim) < 0 | 0 |
1902 | m2 -= i; | - |
1903 | i = 0; | - |
1904 | } | 0 |
1905 | } | 0 |
1906 | b2 += i; | - |
1907 | s2 += i; | - |
1908 | mhi = i2b(1); | - |
1909 | } | 0 |
1910 | if (m2 > 0 && s2 > 0) { evaluated: m2 > 0 yes Evaluation Count:1613 | yes Evaluation Count:617 |
partially evaluated: s2 > 0 yes Evaluation Count:1613 | no Evaluation Count:0 |
| 0-1613 |
1911 | i = m2 < s2 ? m2 : s2; evaluated: m2 < s2 yes Evaluation Count:1160 | yes Evaluation Count:453 |
| 453-1160 |
1912 | b2 -= i; | - |
1913 | m2 -= i; | - |
1914 | s2 -= i; | - |
1915 | } executed: } Execution Count:1613 | 1613 |
1916 | if (b5 > 0) { evaluated: b5 > 0 yes Evaluation Count:1160 | yes Evaluation Count:1070 |
| 1070-1160 |
1917 | if (leftright) { partially evaluated: leftright no Evaluation Count:0 | yes Evaluation Count:1160 |
| 0-1160 |
1918 | if (m5 > 0) { | 0 |
1919 | mhi = pow5mult(mhi, m5); | - |
1920 | b1 = mult(mhi, b); | - |
1921 | Bfree(b); | - |
1922 | b = b1; | - |
1923 | } | 0 |
1924 | if ((j = b5 - m5) != 0) never evaluated: (j = b5 - m5) != 0 | 0 |
1925 | b = pow5mult(b, j); never executed: b = pow5mult(b, j); | 0 |
1926 | } | 0 |
1927 | else | - |
1928 | b = pow5mult(b, b5); executed: b = pow5mult(b, b5); Execution Count:1160 | 1160 |
1929 | } | - |
1930 | S = i2b(1); | - |
1931 | if (s5 > 0) evaluated: s5 > 0 yes Evaluation Count:619 | yes Evaluation Count:1611 |
| 619-1611 |
1932 | S = pow5mult(S, s5); executed: S = pow5mult(S, s5); Execution Count:619 | 619 |
1933 | | - |
1934 | | - |
1935 | | - |
1936 | if (mode < 2) { partially evaluated: mode < 2 no Evaluation Count:0 | yes Evaluation Count:2230 |
| 0-2230 |
1937 | if (!getWord1(d) && !(getWord0(d) & 0xfffff) never evaluated: !getWord1(d) never evaluated: !(getWord0(d) & 0xfffff) | 0 |
1938 | | - |
1939 | && getWord0(d) & 0x7ff00000 never evaluated: getWord0(d) & 0x7ff00000 | 0 |
1940 | | - |
1941 | ) { | - |
1942 | | - |
1943 | b2 += 1; | - |
1944 | s2 += 1; | - |
1945 | spec_case = 1; | - |
1946 | } | 0 |
1947 | else | - |
1948 | spec_case = 0; never executed: spec_case = 0; | 0 |
1949 | } | - |
1950 | if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) != 0) partially evaluated: (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) != 0 yes Evaluation Count:2230 | no Evaluation Count:0 |
evaluated: s5 yes Evaluation Count:619 | yes Evaluation Count:1611 |
| 0-2230 |
1951 | i = 32 - i; executed: i = 32 - i; Execution Count:2230 | 2230 |
1952 | | - |
1953 | | - |
1954 | | - |
1955 | | - |
1956 | if (i > 4) { evaluated: i > 4 yes Evaluation Count:2102 | yes Evaluation Count:128 |
| 128-2102 |
1957 | i -= 4; | - |
1958 | b2 += i; | - |
1959 | m2 += i; | - |
1960 | s2 += i; | - |
1961 | } executed: } Execution Count:2102 | 2102 |
1962 | else if (i < 4) { evaluated: i < 4 yes Evaluation Count:64 | yes Evaluation Count:64 |
| 64 |
1963 | i += 28; | - |
1964 | b2 += i; | - |
1965 | m2 += i; | - |
1966 | s2 += i; | - |
1967 | } executed: } Execution Count:64 | 64 |
1968 | if (b2 > 0) evaluated: b2 > 0 yes Evaluation Count:2166 | yes Evaluation Count:64 |
| 64-2166 |
1969 | b = lshift(b, b2); executed: b = lshift(b, b2); Execution Count:2166 | 2166 |
1970 | if (s2 > 0) partially evaluated: s2 > 0 yes Evaluation Count:2230 | no Evaluation Count:0 |
| 0-2230 |
1971 | S = lshift(S, s2); executed: S = lshift(S, s2); Execution Count:2230 | 2230 |
1972 | if (k_check) { evaluated: k_check yes Evaluation Count:1549 | yes Evaluation Count:681 |
| 681-1549 |
1973 | if (cmp(b,S) < 0) { evaluated: cmp(b,S) < 0 yes Evaluation Count:512 | yes Evaluation Count:1037 |
| 512-1037 |
1974 | k--; | - |
1975 | b = multadd(b, 10, 0); | - |
1976 | if (leftright) partially evaluated: leftright no Evaluation Count:0 | yes Evaluation Count:512 |
| 0-512 |
1977 | mhi = multadd(mhi, 10, 0); never executed: mhi = multadd(mhi, 10, 0); | 0 |
1978 | ilim = ilim1; | - |
1979 | } executed: } Execution Count:512 | 512 |
1980 | } executed: } Execution Count:1549 | 1549 |
1981 | if (ilim <= 0 && mode > 2) { evaluated: ilim <= 0 yes Evaluation Count:1 | yes Evaluation Count:2229 |
partially evaluated: mode > 2 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-2229 |
1982 | if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { partially evaluated: ilim < 0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: cmp(b,S = multadd(S,5,0)) <= 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1983 | | - |
1984 | no_digits: | - |
1985 | k = -1 - ndigits; | - |
1986 | goto ret; executed: goto ret; Execution Count:2 | 2 |
1987 | } | - |
1988 | one_digit: code before this statement executed: one_digit: Execution Count:1 | 1 |
1989 | *s++ = '1'; | - |
1990 | k++; | - |
1991 | goto ret; executed: goto ret; Execution Count:1 | 1 |
1992 | } | - |
1993 | if (leftright) { partially evaluated: leftright no Evaluation Count:0 | yes Evaluation Count:2229 |
| 0-2229 |
1994 | if (m2 > 0) | 0 |
1995 | mhi = lshift(mhi, m2); never executed: mhi = lshift(mhi, m2); | 0 |
1996 | | - |
1997 | | - |
1998 | | - |
1999 | | - |
2000 | | - |
2001 | mlo = mhi; | - |
2002 | if (spec_case) { never evaluated: spec_case | 0 |
2003 | mhi = Balloc(mhi->k); | - |
2004 | memcpy(reinterpret_cast<char *>(&mhi->sign), reinterpret_cast<char *>(&mlo->sign), mlo->wds*sizeof(qint32) + 2*sizeof(int)); | - |
2005 | mhi = lshift(mhi, 1); | - |
2006 | } | 0 |
2007 | | - |
2008 | for(i = 1;;i++) { | - |
2009 | dig = quorem(b,S) + '0'; | - |
2010 | | - |
2011 | | - |
2012 | | - |
2013 | j = cmp(b, mlo); | - |
2014 | delta = diff(S, mhi); | - |
2015 | j1 = delta->sign ? 1 : cmp(b, delta); never evaluated: delta->sign | 0 |
2016 | Bfree(delta); | - |
2017 | | - |
2018 | if (j1 == 0 && !mode && !(getWord1(d) & 1)) { never evaluated: !(getWord1(d) & 1) | 0 |
2019 | if (dig == '9') never evaluated: dig == '9' | 0 |
2020 | goto round_9_up; never executed: goto round_9_up; | 0 |
2021 | if (j > 0) | 0 |
2022 | dig++; | 0 |
2023 | *s++ = dig; | - |
2024 | goto ret; never executed: goto ret; | 0 |
2025 | } | - |
2026 | | - |
2027 | if (j < 0 || (j == 0 && !mode | 0 |
2028 | | - |
2029 | && !(getWord1(d) & 1) never evaluated: !(getWord1(d) & 1) | 0 |
2030 | | - |
2031 | )) { | - |
2032 | if (j1 > 0) { | 0 |
2033 | b = lshift(b, 1); | - |
2034 | j1 = cmp(b, S); | - |
2035 | if ((j1 > 0 || (j1 == 0 && dig & 1)) | 0 |
2036 | && dig++ == '9') never evaluated: dig++ == '9' | 0 |
2037 | goto round_9_up; never executed: goto round_9_up; | 0 |
2038 | } | 0 |
2039 | *s++ = dig; | - |
2040 | goto ret; never executed: goto ret; | 0 |
2041 | } | - |
2042 | if (j1 > 0) { | 0 |
2043 | if (dig == '9') { never evaluated: dig == '9' | 0 |
2044 | round_9_up: | - |
2045 | *s++ = '9'; | - |
2046 | goto roundoff; never executed: goto roundoff; | 0 |
2047 | } | - |
2048 | *s++ = dig + 1; | - |
2049 | goto ret; never executed: goto ret; | 0 |
2050 | } | - |
2051 | *s++ = dig; | - |
2052 | if (i == ilim) never evaluated: i == ilim | 0 |
2053 | break; | 0 |
2054 | b = multadd(b, 10, 0); | - |
2055 | if (mlo == mhi) never evaluated: mlo == mhi | 0 |
2056 | mlo = mhi = multadd(mhi, 10, 0); never executed: mlo = mhi = multadd(mhi, 10, 0); | 0 |
2057 | else { | - |
2058 | mlo = multadd(mlo, 10, 0); | - |
2059 | mhi = multadd(mhi, 10, 0); | - |
2060 | } | 0 |
2061 | } | - |
2062 | } | 0 |
2063 | else | - |
2064 | for(i = 1;; i++) { | - |
2065 | *s++ = dig = quorem(b,S) + '0'; | - |
2066 | if (i >= ilim) evaluated: i >= ilim yes Evaluation Count:2229 | yes Evaluation Count:122213 |
| 2229-122213 |
2067 | break; executed: break; Execution Count:2229 | 2229 |
2068 | b = multadd(b, 10, 0); | - |
2069 | } executed: } Execution Count:122213 | 122213 |
2070 | | - |
2071 | | - |
2072 | | - |
2073 | b = lshift(b, 1); | - |
2074 | j = cmp(b, S); | - |
2075 | if (j > 0 || (j == 0 && dig & 1)) { evaluated: j > 0 yes Evaluation Count:910 | yes Evaluation Count:1319 |
evaluated: j == 0 yes Evaluation Count:68 | yes Evaluation Count:1251 |
evaluated: dig & 1 yes Evaluation Count:64 | yes Evaluation Count:4 |
| 4-1319 |
2076 | roundoff: | - |
2077 | while(*--s == '9') evaluated: *--s == '9' yes Evaluation Count:284 | yes Evaluation Count:974 |
| 284-974 |
2078 | if (s == s0) { partially evaluated: s == s0 no Evaluation Count:0 | yes Evaluation Count:284 |
| 0-284 |
2079 | k++; | - |
2080 | *s++ = '1'; | - |
2081 | goto ret; never executed: goto ret; | 0 |
2082 | } | - |
2083 | ++*s++; | - |
2084 | } executed: } Execution Count:974 | 974 |
2085 | else { | - |
2086 | while(*--s == '0') {} executed: } Execution Count:3515 evaluated: *--s == '0' yes Evaluation Count:3515 | yes Evaluation Count:1255 |
| 1255-3515 |
2087 | s++; | - |
2088 | } executed: } Execution Count:1255 | 1255 |
2089 | ret: code before this statement executed: ret: Execution Count:2229 | 2229 |
2090 | Bfree(S); | - |
2091 | if (mhi) { partially evaluated: mhi no Evaluation Count:0 | yes Evaluation Count:2232 |
| 0-2232 |
2092 | if (mlo && mlo != mhi) never evaluated: mlo != mhi | 0 |
2093 | Bfree(mlo); never executed: Bfree(mlo); | 0 |
2094 | Bfree(mhi); | - |
2095 | } | 0 |
2096 | ret1: code before this statement executed: ret1: Execution Count:2232 | 2232 |
2097 | Bfree(b); | - |
2098 | if (s == s0) { evaluated: s == s0 yes Evaluation Count:2 | yes Evaluation Count:1463099 |
| 2-1463099 |
2099 | *s++ = '0'; | - |
2100 | k = 0; | - |
2101 | } executed: } Execution Count:2 | 2 |
2102 | *s = 0; | - |
2103 | *decpt = k + 1; | - |
2104 | if (rve) partially evaluated: rve yes Evaluation Count:1463101 | no Evaluation Count:0 |
| 0-1463101 |
2105 | *rve = s; executed: *rve = s; Execution Count:1463101 | 1463101 |
2106 | return s0; executed: return s0; Execution Count:1463101 | 1463101 |
2107 | } | - |
2108 | | - |
2109 | | - |
| | |