From 5c9442d7db6e53cac73166e97cc8a7779e283acc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 20 May 2026 17:49:02 +0100 Subject: Add a helper function for calculating a percentage. --- modules/tline.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/tline.cpp') diff --git a/modules/tline.cpp b/modules/tline.cpp index d9cbb9879..33d466e42 100644 --- a/modules/tline.cpp +++ b/modules/tline.cpp @@ -23,6 +23,7 @@ #include "inspircd.h" +#include "utility/numeric.h" class CommandTline final : public Command @@ -61,7 +62,7 @@ public: unsigned long n_counted = ServerInstance->Users.GetUsers().size(); if (n_matched) { - float p = (n_matched / (float)n_counted) * 100; + const auto p = insp::percentage(n_matched, n_counted); user->WriteNotice("*** TLINE: Counted {} user(s). Matched '{}' against {} user(s) ({:0.2}% of the userbase). {} by hostname and {} by IP address.", n_counted, parameters[0], n_matched, p, n_match_host, n_match_ip); } -- cgit v1.3.1-10-gc9f91