fixes
This commit is contained in:
parent
26460cf7f5
commit
3c42aff8f5
@ -34,7 +34,7 @@ function g_calc {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
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"
|
||||||
[[ $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}
|
g_calc_result=${g_calc_result: : -1}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# remove ending . for example "100." -> 100
|
||||||
|
[[ $g_calc_result == *"." ]] && g_calc_result=${g_calc_result%?}
|
||||||
|
|
||||||
# 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