From: bones_was_here Date: Tue, 19 Sep 2023 04:37:30 +0000 (+1000) Subject: Fix occasional NaN sdev in server timing reports X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d72036a01474e96e5de4dcab8756b052ae9e834e;p=xonotic%2Fdarkplaces.git Fix occasional NaN sdev in server timing reports Signed-off-by: bones_was_here --- diff --git a/sv_main.c b/sv_main.c index 15ac48d6..c4168d2e 100644 --- a/sv_main.c +++ b/sv_main.c @@ -2561,7 +2561,8 @@ double SV_Frame(double time) { sv.perf_offset_max = sv.perf_acc_offset_max; sv.perf_offset_avg = sv.perf_acc_offset / sv.perf_acc_offset_samples; - sv.perf_offset_sdev = sqrt(sv.perf_acc_offset_squared / sv.perf_acc_offset_samples - sv.perf_offset_avg * sv.perf_offset_avg); + sv.perf_offset_sdev = sv.perf_acc_offset_squared / sv.perf_acc_offset_samples - sv.perf_offset_avg * sv.perf_offset_avg; + sv.perf_offset_sdev = sv.perf_offset_sdev > 0 ? sqrt(sv.perf_offset_sdev) : 0; } if (sv.perf_lost > 0 && reporting)