From 1c1393c7e36fee64973b2215c96cce08a6004392 Mon Sep 17 00:00:00 2001 From: Thibault Ayanides Date: Tue, 23 Mar 2021 08:36:36 +0100 Subject: [PATCH] Fix div function to manage 0 on numerator (#79) fix #77 Co-authored-by: GoldenKiwi --- lib/common.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/common.sh b/lib/common.sh index 1a3f26f..ce35ef5 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -121,6 +121,10 @@ div() { local _d=${3:-2} local _n=0000000000 _n=${_n:0:$_d} + if (($1 == 0)); then + echo "0" + return + fi if (($2 == 0)); then echo "N.A" return