fixes
This commit is contained in:
parent
855352bdf4
commit
8a3654e42b
@ -38,6 +38,15 @@ function g_calc {
|
|||||||
[[ $g_calc_result == "."* ]] && g_calc_result="0$g_calc_result"
|
[[ $g_calc_result == "."* ]] && g_calc_result="0$g_calc_result"
|
||||||
[[ $g_calc_result == "-."* ]] && g_calc_result="-0.${g_calc_result#-.}"
|
[[ $g_calc_result == "-."* ]] && g_calc_result="-0.${g_calc_result#-.}"
|
||||||
|
|
||||||
|
# remove ending 0 if for exabple 4.54300000
|
||||||
|
if [[ $g_calc_result =~ [0-9]+\.[0-9]+ ]]
|
||||||
|
then
|
||||||
|
while [[ $g_calc_result =~ \.?[0-9]+0$ ]]
|
||||||
|
do
|
||||||
|
g_calc_result=${g_calc_result%0}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# check output
|
# check output
|
||||||
if ! g_num_valid_number $g_calc_result
|
if ! g_num_valid_number $g_calc_result
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user