{{/* Math */}}
{{"https://gohugo.io/functions/math" | markdownify }}
{{`Adds two integers`}}
{{add 1 2}}
{{`works with float as well`}}
{{add 1.5 2.3}}
{{`Divides two integers`}}
{{div 6 3}}
{{`works with float as well`}}
{{div 7.6 2.5}}
{{`Modulus of two integers`}}
{{mod 16 3}}
{{`looks like floats are cutted to integers`}}
{{mod 10.5 4.5}}
{{`Boolean of modulus of two integers. Evaluates to true if result equals 0.`}}
{{modBool 15 3}}
{{modBool 16 3}}
{{`Multiplies two integers`}}
{{mul 2 3}}
{{`works with float as well`}}
{{mul 2.5 3.1}}
{{`Subtracts two integers`}}
{{sub 3 2}}
{{`works with float as well`}}
{{mul 3.5 2.1}}
{{`Returns the least integer value greater than or equal to the given number`}}
{{math.Ceil 2.000000001}}
{{math.Ceil 2.9}}
{{`Returns the greatest integer value less than or equal to the given number`}}
{{math.Floor 1.9}}
{{math.Floor 1.1}}
{{`Returns the nearest integer, rounding half away from zero`}}
{{math.Round 1.5}}
{{math.Round 1.45}}
{{div (math.Round (mul 1.32 10)) 10}}
{{div (math.Round (mul 1.36 10)) 10}}
https://gohugo.io/functions/math
Adds two integers
3
works with float as well
3.8
Divides two integers
2
works with float as well
3.04
Modulus of two integers
1
looks like floats are cutted to integers
2
Boolean of modulus of two integers. Evaluates to true if result equals 0.
true
false
Multiplies two integers
6
works with float as well
7.75
Subtracts two integers
1
works with float as well
7.3500000000000005
Returns the least integer value greater than or equal to the given number
3
3
Returns the greatest integer value less than or equal to the given number
1
1
Returns the nearest integer, rounding half away from zero
2
1
1.3
1.4