package math

import "github.com/gohugoio/hugo/tpl/math"

Package math provides template functions for mathmatical operations.

Index

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) Add

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

Add adds two numbers.

func (*Namespace) Ceil

func (ns *Namespace) Ceil(x interface{}) (float64, error)

Ceil returns the least integer value greater than or equal to x.

func (*Namespace) Div

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

Div divides two numbers.

func (*Namespace) Floor

func (ns *Namespace) Floor(x interface{}) (float64, error)

Floor returns the greatest integer value less than or equal to x.

func (*Namespace) Log

func (ns *Namespace) Log(a interface{}) (float64, error)

Log returns the natural logarithm of a number.

func (*Namespace) Mod

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

Mod returns a % b.

func (*Namespace) ModBool

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

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

Mul multiplies two numbers.

func (*Namespace) Round

func (ns *Namespace) Round(x interface{}) (float64, error)

Round returns the nearest integer, rounding half away from zero.

func (*Namespace) Sub

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

Sub subtracts two numbers.

Source Files

init.go math.go round.go

Version
v0.56.2
Published
Jul 30, 2019
Platform
linux/amd64
Imports
6 packages
Last checked
3 hours ago

Tools for package owners.