Documentation
¶
Index ¶
- func Change[T constraints.Integer | constraints.Float](before, after T) float64
- func FromRatio[T constraints.Integer | constraints.Float](ratio T) float64
- func Percent[T constraints.Integer | constraints.Float](percent, value T) float64
- func PercentOf[T constraints.Integer | constraints.Float](part, total T) float64
- func Remain[T constraints.Integer | constraints.Float](percent, value T) float64
- func ToRatio[T constraints.Integer | constraints.Float](percent T) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Change ¶
func Change[T constraints.Integer | constraints.Float](before, after T) float64
Change returns the percent increase/decrease from two numbers.
func FromRatio ¶
func FromRatio[T constraints.Integer | constraints.Float](ratio T) float64
FromRatio returns the percent of ratio.
func Percent ¶
func Percent[T constraints.Integer | constraints.Float](percent, value T) float64
Percent returns the value of a percentage of a value.
func PercentOf ¶
func PercentOf[T constraints.Integer | constraints.Float](part, total T) float64
PercentOf returns the percentage of a part in the total value.
func Remain ¶
func Remain[T constraints.Integer | constraints.Float](percent, value T) float64
Remain returns the value that remains after subtracting the percentage.
func ToRatio ¶
func ToRatio[T constraints.Integer | constraints.Float](percent T) float64
ToRatio returns the ratio of percent.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.