OpenCoverage

ftoastr.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/ftoastr.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5int-
6dtoastr (char *buf, size_t bufsize, int flags, int width, double x)-
7{-
8 double promoted_x = x;-
9 char format[sizeof "%-+ 0*.*Lg"];-
10 double abs_x = x < 0
x < 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • od
FALSEevaluated 1076 times by 2 tests
Evaluated by:
  • getlimits
  • od
? -x : x;
6-1076
11 int prec;-
12-
13 char *p = format;-
14 *p++ = '%';-
15-
16-
17 *p = '-'; p += (flags & FTOASTR_LEFT_JUSTIFY ) != 0;-
18 *p = '+'; p += (flags & FTOASTR_ALWAYS_SIGNED ) != 0;-
19 *p = ' '; p += (flags & FTOASTR_SPACE_POSITIVE) != 0;-
20 *p = '0'; p += (flags & FTOASTR_ZERO_PAD ) != 0;-
21-
22 *p++ = '*';-
23 *p++ = '.';-
24 *p++ = '*';-
25 *p = 'L'; p += 2 < 2;-
26 *p++ = flags & FTOASTR_UPPER_E
flags & FTOASTR_UPPER_EDescription
TRUEnever evaluated
FALSEevaluated 1082 times by 2 tests
Evaluated by:
  • getlimits
  • od
? 'G' : 'g';
0-1082
27 *p = '\0';-
28-
29 for (prec = abs_x < ((double)2.22507385850720138309e-308L) ? 1 : 15; ; prec++)-
30 {-
31 int n = snprintf (buf, bufsize, format, width, prec, promoted_x);-
32 if (n < 0
n < 0Description
TRUEnever evaluated
FALSEevaluated 2790 times by 2 tests
Evaluated by:
  • getlimits
  • od
0-2790
33 || (((((
(((((53) * 1) ...) + 1) <= precDescription
TRUEevaluated 357 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEevaluated 2433 times by 2 tests
Evaluated by:
  • getlimits
  • od
53) * 1) * 146 + 484) / 485) + 1) <= prec
(((((53) * 1) ...) + 1) <= precDescription
TRUEevaluated 357 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEevaluated 2433 times by 2 tests
Evaluated by:
  • getlimits
  • od
357-2433
34 || (n < bufsize
n < bufsizeDescription
TRUEevaluated 2433 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEnever evaluated
&& strtod (buf,
strtod (buf, (...id *)0) ) == xDescription
TRUEevaluated 725 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEevaluated 1708 times by 2 tests
Evaluated by:
  • getlimits
  • od
0-2433
35 ((void *)0)
strtod (buf, (...id *)0) ) == xDescription
TRUEevaluated 725 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEevaluated 1708 times by 2 tests
Evaluated by:
  • getlimits
  • od
725-1708
36 ) == x
strtod (buf, (...id *)0) ) == xDescription
TRUEevaluated 725 times by 2 tests
Evaluated by:
  • getlimits
  • od
FALSEevaluated 1708 times by 2 tests
Evaluated by:
  • getlimits
  • od
))
725-1708
37 return
executed 1082 times by 2 tests: return n;
Executed by:
  • getlimits
  • od
n;
executed 1082 times by 2 tests: return n;
Executed by:
  • getlimits
  • od
1082
38 }
executed 1708 times by 2 tests: end of block
Executed by:
  • getlimits
  • od
1708
39}
never executed: end of block
0
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2