gaboshlib/g_percentage-diff.bashfunc aktualisiert
This commit is contained in:
parent
bd3f476d09
commit
53c2651fa8
@ -1,7 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function g_percentage-diff {
|
function g_percentage-diff {
|
||||||
local g_from=$1
|
local g_from=$1
|
||||||
local g_to=$2
|
local g_to=$2
|
||||||
printf -- "%.2f" $(g_calc "100/${g_from}*(${g_to}-${g_from})")
|
g_num_valid_number "$g_from" "$g_to" || return 1
|
||||||
}
|
[ $(g_calc "${g_from} == 0") -eq 1 ] && return 1
|
||||||
|
[ $(g_calc "${g_to} == 0") -eq 1 ] && return 1
|
||||||
|
printf -- "%.2f" $(g_calc "100/${g_from}*(${g_to}-${g_from})")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user