HUGO
Menu
GitHub 90265 stars Mastodon

math.Round

Returns the nearest integer, rounding half away from zero.
Syntax
math.Round VALUE
Returns
float64

Usage

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

Examples

{{ math.Round 1.4 }} → 1
{{ math.Round 1.5 }} → 2
{{ math.Round 2.5 }} → 3

With a negative number:

{{ math.Round -1.5 }} → -2