Gopher

math

Math is Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

math.Add  

(a any) → any

Add adds two numbers.

Aliases: add

Examples

{{add 1 2}}
3

math.Ceil  

(x any) → float

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

Examples

{{math.Ceil 2.1}}
3

math.Counter  

() → uint64

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.

math.Div  

(a any) → any

Div divides two numbers.

Aliases: div

Examples

{{div 6 3}}
2

math.Floor  

(x any) → float

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

Examples

{{math.Floor 1.9}}
1

math.Log  

(a any) → float

Log returns the natural logarithm of a number.

Examples

{{math.Log 1}}
0

math.Max  

(a any) → float

Max returns the greater of two numbers.

Examples

{{math.Max 1 2 }}
2

math.Min  

(a any) → float

Min returns the smaller of two numbers.

Examples

{{math.Min 1 2 }}
1

math.Mod  

(a any) → int64

Mod returns a % b.

Aliases: mod

Examples

{{mod 15 3}}
0

math.ModBool  

(a any) → bool

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

Aliases: modBool

Examples

{{modBool 15 3}}
true

math.Mul  

(a any) → any

Mul multiplies two numbers.

Aliases: mul

Examples

{{mul 2 3}}
6

math.Pow  

(a any) → float

Pow returns a raised to the power of b.

Aliases: pow

Examples

{{math.Pow 2 3}}
8

math.Round  

(x any) → float

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

Examples

{{math.Round 1.5}}
2

math.Sqrt  

(a any) → float

Sqrt returns the square root of a number.

Examples

{{math.Sqrt 81}}
9

math.Sub  

(a any) → any

Sub subtracts two numbers.

Aliases: sub

Examples

{{sub 3 2}}
1