GCC Code Coverage Report


Directory: ./
File: lib/my/my_printf/precise_it_double.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 1 1 100.0%
Branches: 5 6 83.3%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_printf
4 ** File description:
5 ** The functions for precise a double
6 */
7 /**
8 * @file precise_it_double.c
9 * @brief The file containing the precise_it_double function
10 * @author Nicolas TORO
11 */
12
13 #include "myprintf.h"
14
15 34 void precise_it_double(char *str_finale,
16 formating_t *formating, double partie_d)
17 {
18
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 33 times.
34 int precision = (formating->id_prc != -1) ? (formating->id_nb) : 6;
19
20
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 if (precision != 0) {
21 34 my_strcat(str_finale, ".");
22
2/2
✓ Branch 0 taken 203 times.
✓ Branch 1 taken 34 times.
237 for (int i = 0; i < precision; i++) {
23 203 partie_d *= 10;
24 203 my_strcat(str_finale, my_str_nbr(partie_d));
25 203 partie_d -= (int)partie_d;
26 }
27 }
28 34 my_round_float_str(str_finale, 48 + (partie_d * 10),
29 34 my_strlen(str_finale) - 1, 0);
30 34 }
31