diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fcb405b..b4be6835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### [13.5.1](https://kaos.sh/ek/13.5.1) + +- `[mathutil]` Code refactoring + ### [13.5.0](https://kaos.sh/ek/13.5.0) - `[support/resources]` Added package for collecting info about CPU and memory diff --git a/mathutil/mathutil.go b/mathutil/mathutil.go index 6631ee96..09dea125 100644 --- a/mathutil/mathutil.go +++ b/mathutil/mathutil.go @@ -122,12 +122,12 @@ func Abs[N NumericNeg](val N) N { } // Perc calculates percentage -func Perc[N Numeric](val1, val2 N) float64 { - if val2 == 0 { +func Perc[N Numeric](current, total N) float64 { + if current == 0 || total == 0 { return 0 } - return float64(val1) / float64(val2) * 100.0 + return (float64(current) / float64(total)) * 100.0 } // Round returns rounded value diff --git a/version.go b/version.go index 3df16829..9efe2a5a 100644 --- a/version.go +++ b/version.go @@ -8,4 +8,4 @@ package ek // ////////////////////////////////////////////////////////////////////////////////// // // VERSION is current ek package version -const VERSION = "13.5.0" +const VERSION = "13.5.1"