Skip to main content

Math Operators

Math operators describe mathematical formulas in markdown to dynamically calculate numerical values on the deal.

List of Operators

{{ abs }}​

Return the magnitude of a.

Params

  • a
  • returns

Example

{{abs -1000}}
<!-- results in: '1000' -->
{{abs 3.45}}
<!-- results in: '3.45' -->

{{ add }}​

Return the sum of a plus b.

Params

  • a
  • b
  • returns

Example

{{add 335 5}}
<!-- results in: '340' -->

{{ avg }}​

Return the average of all numbers in the given array.

Params

  • array : Array of numbers to add up.
  • returns

Example

{{avg 1 2 3}}
<!-- results in: '2' -->

{{ ceil }}​

Round up and return the smaller integer greater than or equal to the given number.

Params

  • value
  • returns

Example

{{ceil 6.0021}}
<!-- results in: '7' -->

{{ divide }}​

Divide a by b

Params

  • a : numerator
  • b : denominator

Example

{{divide 8 2}}
<!-- results in: '4' -->

{{ floor }}​

Round down and return the largest integer greater than or equal to the given number.

Params

  • value
  • returns

Example

{{floor 6.0021}}
<!-- results in: '6' -->

{{ max }}​

Return the maximum of two numbers.

Params

  • a : a
  • b : b
  • returns

Example

{{max 8 3}}
<!-- results in: '8' -->

{{ min }}​

Return the minimum of two numbers.

Params

  • a : a
  • b : b
  • returns

Example

{{min 8 3}}
<!-- results in: '3' -->

{{ modulo }}​

Return the remainder of a division operation.

Params

  • a
  • b
  • returns

Example

{{modulo 17 3}}
<!-- results in: '2' -->

{{ multiply }}​

Return the product of number a times number b.

Params

  • a : factor
  • b : multiplier
  • returns

Example

{{multiply 8 3}}
<!-- results in: '24' -->

{{ multiplyAll }}​

Return the product of a times b and c.

Params

  • a : factor
  • b : multiplier
  • c : multiplier
  • ... additional numbers
  • returns

Example

{{multiplyAll 8 3 6}}
<!-- results in: '144' -->

{{ pow }}​

Return the value of a base raised to a power.

Params

  • base : base
  • exponent : exponent
  • returns

Example

{{pow 2 3}}
<!-- results in: '8' -->

{{ random }}​

Generate a random number between two values.

Params

  • min
  • max
  • returns

Example

{{random 4 50}}
<!-- results in a random number between 4 and 50 -->

{{ remainder }}​

Return the remainder when a is divided by b.

Params

  • a : a
  • b : b

Example

{{remainder 100 24}}
<!-- results in: '4' -->

{{ round }}​

Round the given number to the closest integer.

Params

  • a
  • returns

Example

{{round 4.0045}}
<!-- results in: '4' -->
{{round 3.74}}
<!-- results in: '4' -->

{{ subtract }}​

Return the value of number a minus number b.

Params

  • a
  • b
  • returns

Example

{{subtract 34 4}}
<!-- results in: '30' -->

{{ sum }}​

Return the sum of all numbers in the given array.

Params

  • a
  • b
  • ... additional numbers
  • returns

Example

{{sum 1 2 3 4}}
<!-- results in: '10' -->

{{ times }}​

Multiply number a by number b.

Params

  • a : factor
  • b : multiplier
  • returns

Example

{{times 5 10}}
<!-- results in: '50' -->