From e16346d45721cb2d075ab1ece30042f7de595385 Mon Sep 17 00:00:00 2001 From: Connor E <38229097+c-edw@users.noreply.github.com> Date: Sat, 17 Nov 2018 15:07:12 +0000 Subject: [PATCH] Change numlen function to handle negative numbers properly. --- common/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/util.c b/common/util.c index 32b693a449..abaca17fe9 100644 --- a/common/util.c +++ b/common/util.c @@ -23,7 +23,8 @@ int numlen(int n) { if (n == 0) { return 1; } - return log10(abs(n)) + 1; + // Account for the '-' in negative numbers. + return log10(abs(n)) + (n > 0 ? 1 : 2); } static struct modifier_key {