MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_strtod_int

Function my_strtod_int

strings/dtoa.c:1350–2075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1348*/
1349
1350static double my_strtod_int(const char *s00, char **se, int *error, char *buf, size_t buf_size)
1351{
1352 int scale;
1353 int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, UNINIT_VAR(c), dsign,
1354 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
1355 const char *s, *s0, *s1, *end = *se;
1356 double aadj, aadj1;
1357 U aadj2, adj, rv, rv0;
1358 Long L;
1359 ULong y, z;
1360 Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
1361#ifdef SET_INEXACT
1362 int inexact, oldinexact;
1363#endif
1364#ifdef Honor_FLT_ROUNDS
1365 int rounding;
1366#endif
1367 Stack_alloc alloc;
1368
1369 *error= 0;
1370
1371 alloc.begin= alloc.free= buf;
1372 alloc.end= buf + buf_size;
1373 memset(alloc.freelist, 0, sizeof(alloc.freelist));
1374
1375 sign= nz0= nz= 0;
1376 dval(&rv)= 0.;
1377 for (s= s00; s < end; s++)
1378 switch (*s) {
1379 case '-':
1380 sign= 1;
1381 /* no break */
1382 case '+':
1383 s++;
1384 goto break2;
1385 case '\t':
1386 case '\n':
1387 case '\v':
1388 case '\f':
1389 case '\r':
1390 case ' ':
1391 continue;
1392 default:
1393 goto break2;
1394 }
1395 break2:
1396 if (s >= end)
1397 goto ret0;
1398
1399 if (*s == '0')
1400 {
1401 nz0= 1;
1402 while (++s < end && *s == '0') ;
1403 if (s >= end)
1404 goto ret;
1405 }
1406 s0= s;
1407 y= z= 0;

Callers 1

my_strtodFunction · 0.85

Calls 12

s2bFunction · 0.85
BallocFunction · 0.85
d2bFunction · 0.85
i2bFunction · 0.85
pow5multFunction · 0.85
multFunction · 0.85
BfreeFunction · 0.85
lshiftFunction · 0.85
diffFunction · 0.85
cmpFunction · 0.85
ulpFunction · 0.85
ratioFunction · 0.85

Tested by

no test coverage detected