Documentation ¶
Overview ¶
Package math provides template functions for mathematical operations.
Index ¶
- type Namespace
- func (ns *Namespace) Abs(n any) (float64, error)
- func (ns *Namespace) Add(inputs ...any) (any, error)
- func (ns *Namespace) Ceil(n any) (float64, error)
- func (ns *Namespace) Counter() uint64
- func (ns *Namespace) Div(inputs ...any) (any, error)
- func (ns *Namespace) Floor(n any) (float64, error)
- func (ns *Namespace) Log(n any) (float64, error)
- func (ns *Namespace) Max(inputs ...any) (maximum float64, err error)
- func (ns *Namespace) Min(inputs ...any) (minimum float64, err error)
- func (ns *Namespace) Mod(n1, n2 any) (int64, error)
- func (ns *Namespace) ModBool(n1, n2 any) (bool, error)
- func (ns *Namespace) Mul(inputs ...any) (any, error)
- func (ns *Namespace) Pow(n1, n2 any) (float64, error)
- func (ns *Namespace) Round(n any) (float64, error)
- func (ns *Namespace) Sqrt(n any) (float64, error)
- func (ns *Namespace) Sub(inputs ...any) (any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct{}
Namespace provides template functions for the "math" namespace.
func New ¶
func New() *Namespace
New returns a new instance of the math-namespaced template functions.
func (*Namespace) Counter ¶ added in v0.16.0
Counter increments and returns a global counter. This was originally added to be used in tests where now.UnixNano did not have the needed precision (especially on Windows). Note that given the parallel nature of Hugo, you cannot use this to get sequences of numbers, and the counter will reset on new builds. <docsmeta>{"identifiers": ["now.UnixNano"] }</docsmeta>
func (*Namespace) Max ¶ added in v0.9.0
Max returns the greater of the multivalued numbers n1 and n2 or more values.
func (*Namespace) Min ¶ added in v0.9.0
Min returns the smaller of multivalued numbers n1 and n2 or more values.