Documentation
¶
Overview ¶
Package math provides template functions for mathematical operations.
Index ¶
- type Namespace
- func (ns *Namespace) Abs(n any) (float64, error)
- func (ns *Namespace) Acos(n any) (float64, error)
- func (ns *Namespace) Add(inputs ...any) (any, error)
- func (ns *Namespace) Asin(n any) (float64, error)
- func (ns *Namespace) Atan(n any) (float64, error)
- func (ns *Namespace) Atan2(n, m any) (float64, error)
- func (ns *Namespace) Ceil(n any) (float64, error)
- func (ns *Namespace) Cos(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) MaxInt64() int64
- 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) Pi() float64
- func (ns *Namespace) Pow(n1, n2 any) (float64, error)
- func (ns *Namespace) Product(inputs ...any) (product float64, err error)
- func (ns *Namespace) Rand() float64
- func (ns *Namespace) Round(n any) (float64, error)
- func (ns *Namespace) Sin(n any) (float64, error)
- func (ns *Namespace) Sqrt(n any) (float64, error)
- func (ns *Namespace) Sub(inputs ...any) (any, error)
- func (ns *Namespace) Sum(inputs ...any) (sum float64, err error)
- func (ns *Namespace) Tan(n any) (float64, error)
- func (ns *Namespace) ToDegrees(n any) (float64, error)
- func (ns *Namespace) ToRadians(n any) (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace provides template functions for the "math" namespace.
func (*Namespace) Atan2 ¶
Atan2 returns the arc tangent of n/m, using the signs of the two to determine the quadrant of the return value.
func (*Namespace) Counter ¶
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 ¶
Max returns the greater of all numbers in inputs. Any slices in inputs are flattened.
func (*Namespace) Min ¶
Min returns the smaller of all numbers in inputs. Any slices in inputs are flattened.
func (*Namespace) Product ¶
Product returns the product of all numbers in inputs. Any slices in inputs are flattened.
func (*Namespace) Rand ¶
Rand returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0).
func (*Namespace) Sum ¶
Sum returns the sum of all numbers in inputs. Any slices in inputs are flattened.