From 3c42aff8f5b18e26184ebc19e37467d2fb3451ac Mon Sep 17 00:00:00 2001 From: olli <> Date: Tue, 2 Jul 2024 17:45:12 +0200 Subject: [PATCH] fixes --- gaboshlib/g_calc.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gaboshlib/g_calc.sh b/gaboshlib/g_calc.sh index 7542913..763547e 100644 --- a/gaboshlib/g_calc.sh +++ b/gaboshlib/g_calc.sh @@ -34,7 +34,7 @@ function g_calc { return 1 fi - # fix bc outpur -> change for example .224 to 0.224 and -.224 to -0.224 + # fix bc output -> change for example .224 to 0.224 and -.224 to -0.224 [[ $g_calc_result == "."* ]] && g_calc_result="0$g_calc_result" [[ $g_calc_result == "-."* ]] && g_calc_result="-0.${g_calc_result#-.}" @@ -44,6 +44,9 @@ function g_calc { g_calc_result=${g_calc_result: : -1} done + # remove ending . for example "100." -> 100 + [[ $g_calc_result == *"." ]] && g_calc_result=${g_calc_result%?} + # check output if ! g_num_valid_number $g_calc_result then