Skip to content

Commit

Permalink
[mathutil] Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Sep 16, 2024
1 parent b9bb86c commit bab2958
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions mathutil/mathutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ package ek
// ////////////////////////////////////////////////////////////////////////////////// //

// VERSION is current ek package version
const VERSION = "13.5.0"
const VERSION = "13.5.1"

0 comments on commit bab2958

Please sign in to comment.