| 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 | #include "my.h" | ||
| 9 | #include "myformats.h" | ||
| 10 | |||
| 11 | 28 | void precise_it_double(char *str_finale, | |
| 12 | formating_t *formating, double partie_d) | ||
| 13 | { | ||
| 14 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 27 times.
|
28 | int precision = (formating->id_prc != -1) ? (formating->id_nb) : 6; |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | if (precision != 0) { |
| 17 | 28 | my_strcat(str_finale, "."); | |
| 18 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 28 times.
|
195 | for (int i = 0; i < precision; i++) { |
| 19 | 167 | partie_d *= 10; | |
| 20 | 167 | my_strcat(str_finale, my_str_nbr(partie_d)); | |
| 21 | 167 | partie_d -= (int)partie_d; | |
| 22 | } | ||
| 23 | } | ||
| 24 | 28 | my_round_float_str(str_finale, 48 + (partie_d * 10), | |
| 25 | 28 | my_strlen(str_finale) - 1, 0); | |
| 26 | 28 | } | |
| 27 |