hugo/content/functions/math.md
Bjørn Erik Pedersen 9d68f695e7 Squashed 'docs/' changes from 20959c7b..36d7e22f
36d7e22f Document fmt.{print, println} template functions
79a72fce Fix link to page variables
00342ca9 Fix broken link on highlight page
15f44952 Fix link in v0.28 release notes
0100df73 Fix code examples for math.{Ceil, Floor, Round}
a354a69b Fix broken netlify.toml
4995e5df Merge branch 'master' of github.com:gohugoio/hugoDocs
9cdd990a Hugo 0.29
463558f9 Document math.Log template function
588499af Add nohup.out to .gitignore
db8ddcf7 Change name of post files in example to use post prefix
296ec01f Add ox-hugo Emacs package to the tools section
f060d6d1 Fix math.Ceil, Floor, and Round naming
a2262d24 Document strings.TrimPrefix and TrimSuffix template functions
80c1ce63 Document strings.TrimLeft and TrimRight template functions
2921088d Document urls.Parse template function
f0133079 Document math.{ceil, floor, round} template functions
82863808 Fix typo in migration tools section
d5215d61 Add link to syntax hl docs in release notes
541f0686 Update versions
275ce2b4 Update 0.28 release notes
886713a1 Add release notes for 0.28
bed02e5f Merge branch 'next'
8e3b1ac4 Add a note about branches
1662b9d0 Add missing Disqus links in templates/internal.md

git-subtree-dir: docs
git-subtree-split: 36d7e22f5c21c550bd87782d2ddca666178fe1ff
2017-09-28 17:20:10 +02:00

1.8 KiB

title description godocref date publishdate lastmod keywords categories menu toc signature workson hugoversion relatedfuncs deprecated draft aliases
Math Hugo provides nine mathematical operators in templates. 2017-02-01 2017-02-01 2017-02-01
math
operators
functions
docs
parent
functions
false false
Function Description Example
add Adds two integers. {{add 1 2}} → 3
div Divides two integers. {{div 6 3}} → 2
mod Modulus of two integers. {{mod 15 3}} → 0
modBool Boolean of modulus of two integers. Evaluates to true if result equals 0. {{modBool 15 3}} → true
mul Multiplies two integers. {{mul 2 3}} → 6
sub Subtracts two integers. {{sub 3 2}} → 1
math.Ceil Returns the least integer value greater than or equal to the given number. {{math.Ceil 2.1}} → 3
math.Floor Returns the greatest integer value less than or equal to the given number. {{math.Floor 1.9}} → 1
math.Round Returns the nearest integer, rounding half away from zero. {{math.Round 1.5}} → 2