fix compilation error and fix stddev calculation

This commit is contained in:
2025-05-02 23:57:11 +02:00
parent e3a2901370
commit b96652f9a4
3 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
/* Updated: 2025/05/02 01:04:29 by tomoron ### ########.fr */
/* Updated: 2025/05/02 23:55:50 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,6 +50,8 @@ void ping_end_print(t_settings *set, char *host, t_stats *stats)
(void)set;
stddev = sqrt(stats->sqr_diff / (stats->received - 1));
if(isnan(stddev) || isinf(stddev))
stddev = 0.0f;
printf("--- %s ping statistics ---\n", host);
percent = ((double)stats->sent / 100) * stats->received;
printf("%lu packets transmitted, %lu packets received, %d%% packet loss\n", stats->sent, stats->received, percent);