Documentation ¶
Overview ¶
Package numutil implements number helpers
Index ¶
- func ChangeByPercent[T Number](value T, percent float64) float64
- func Drawdown[T Number](high T, regular T) float64
- func Percent[T Number](percent T, total T) float64
- func PercentDiff[T Number](before T, after T) float64
- func PercentOf[T Number](part T, total T) float64
- func Round[T float32 | float64](value T, precision uint) float64
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeByPercent ¶
ChangeByPercent calculates change of given number by given percent
func PercentDiff ¶
PercentDiff calculates percentage difference between two numbers
Types ¶
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
Number is a constraint that covers any integer or float type
Click to show internal directories.
Click to hide internal directories.