exponential2normal

This commit is contained in:
olli 2024-06-23 15:02:43 +02:00
parent 860af0e870
commit e1dbc5b9d1

View File

@ -2,7 +2,7 @@
function g_num_exponential2normal { function g_num_exponential2normal {
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
# if there is a exponential number (for example 9.881e-05) convert it to "normal" notation # if there is a exponential number (for example 9.881e-05) convert it to "normal" notation
if [[ "$1" =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?(e-[0-9]+)?$ ]] if [[ "$1" =~ e-[0-9] ]]
then then
# convert # convert
printf -v f_g_num_exponential2normal_result -- "%.12f" "$1" printf -v f_g_num_exponential2normal_result -- "%.12f" "$1"