exponential numbers to normal

This commit is contained in:
olli 2023-11-28 15:02:16 +01:00
parent 2569ab41be
commit 3b0f1f8e3a

View File

@ -143,7 +143,8 @@ function get_var_from_line {
f_empty_var=1
fi
else
#declare -g f_$1="$(echo ${f_last_line_array[$2]})"
# next line for exponential numbers (e.g. 7.86890874600464e05) to "normal" - coming sometimes from coingecko
[[ ${f_last_line_array[$2]} =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?(e-[0-9]+)?$ ]] && printf -v f_last_line_array[$2] -- "%.10f" "${f_last_line_array[$2]}"
declare -g f_$1="${f_last_line_array[$2]}"
fi
f_all_vars="$f_all_vars