Skip to content
On this page

Index

func Div

go
func Div[T constraints.Integer | constraints.Float](vals ...T) T

Div returns the division of the first value to the second and later. Makes no sense in unual use-cases, but useful in templates.

Usage:

arithmetic.Div(5, 2, 2) // 1.25
arithmetic.Div([]int{5, 2, 2}...) // 1.25

func DivRuntime

go
func DivRuntime(vals ...any) any

DivRuntime is a runtime version of arithmetic.Div.

func Mul

go
func Mul[T constraints.Integer | constraints.Float](vals ...T) T

Mul returns the multiplication result of the given values.

Usage:

arithmetic.Mul(1, 2, 3) // 6
arithmetic.Mul([]float64{3.4, 6.5, 4.3}...) // 95.03

func MulRuntime

go
func MulRuntime(vals ...any) any

MulRuntime is a runtime version of arithmetic.Mul.

func Sub

go
func Sub[T constraints.Integer | constraints.Float](vals ...T) T

Sub returns the subtraction of the given values from the first one.

Usage:

arithmeric.Sub(4, 2, 1) // 1
arithmetic.Sub([]float64{5.4, 3, 1}...) // 1.4

func SubRuntime

go
func SubRuntime(vals ...any) any

SubRuntime is a runtime version of arithmetic.Sub.

func Sum

go
func Sum[T constraints.Integer | constraints.Float | string](vals ...T) T

Sum returns the sum of the given values.

Usage:

arithmeric.Sum(4, 2, 1) // 7
arithmetic.Sum([]float64{5.4, 3, 1}...) // 9.4

func SumRuntime

go
func SumRuntime(vals ...any) any

SumRuntime is a runtime version of arithmetic.Sum.

Generated by gomarkdoc