mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
@@ -3,7 +3,7 @@ title: Math
|
||||
description: Hugo provides mathematical operators in templates.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2023-03-11
|
||||
lastmod: 2023-05-15
|
||||
keywords: [math, operators]
|
||||
categories: [functions]
|
||||
menu:
|
||||
@@ -31,6 +31,7 @@ aliases: []
|
||||
| | *If one of the numbers is a float, the result is a float.* | `{{ div 6 4.0 }}` → `1.5` |
|
||||
| `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` |
|
||||
| `math.Abs` | Returns the absolute value of the given number. | `{{ math.Abs -2.1 }}` → `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.Log` | Returns the natural logarithm of the given number. | `{{ math.Log 42 }}` → `3.737` |
|
||||
|
Reference in New Issue
Block a user