hugo: Index | Files

package math

import ""


Package Files

init.go math.go

func DoArithmetic Uses

func DoArithmetic(a, b interface{}, op rune) (interface{}, error)

DoArithmetic performs arithmetic operations (+,-,*,/) using reflection to determine the type of the two terms.

type Namespace Uses

type Namespace struct{}

Namespace provides template functions for the "math" namespace.

func New Uses

func New() *Namespace

New returns a new instance of the math-namespaced template functions.

func (*Namespace) Add Uses

func (ns *Namespace) Add(a, b interface{}) (interface{}, error)

func (*Namespace) Div Uses

func (ns *Namespace) Div(a, b interface{}) (interface{}, error)

func (*Namespace) Mod Uses

func (ns *Namespace) Mod(a, b interface{}) (int64, error)

Mod returns a % b.

func (*Namespace) ModBool Uses

func (ns *Namespace) ModBool(a, b interface{}) (bool, error)

ModBool returns the boolean of a % b. If a % b == 0, return true.

func (*Namespace) Mul Uses

func (ns *Namespace) Mul(a, b interface{}) (interface{}, error)

func (*Namespace) Sub Uses

func (ns *Namespace) Sub(a, b interface{}) (interface{}, error)

Package math imports 4 packages (graph) and is imported by 4 packages. Updated 2017-06-13. Refresh now. Tools for package owners.