Math Operators

When we need to work with math, these operators will help with your markdown.

List of Operators

{{abs}}

Return the magnitude of a.

Params

  • a {Number}
  • returns {Number}

{{add}}

Return the sum of a plus b.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{avg}}

Returns the average of all numbers in the given array.

Params

  • array {Array}: Array of numbers to add up.
  • returns {Number}

Example

{{avg "[1, 2, 3, 4, 5]"}}
<!-- results in: '3' -->

{{ceil}}

Get the Math.ceil() of the given value.

Params

  • value {Number}
  • returns {Number}

{{divide}}

Divide a by b

Params

  • a {Number}: numerator
  • b {Number}: denominator

{{floor}}

Get the Math.floor() of the given value.

Params

  • value {Number}
  • returns {Number}

{{minus}}

Return the difference of a minus b.

Params

  • a {Number}
  • b {Number}

{{modulo}}

Get the remainder of a division operation.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{multiply}}

Return the product of a times b.

Params

  • a {Number}: factor
  • b {Number}: multiplier
  • returns {Number}

{{multiplyAll}}

Return the product of a times b and c.

Params

  • a {Number}: factor
  • b {Number}: multiplier
  • c {Number}: multiplier
  • ... additional numbers
  • returns {Number}

{{plus}}

Add a by b.

Params

  • a {Number}: factor
  • b {Number}: multiplier

{{random}}

Generate a random number between two values

Params

  • min {Number}
  • max {Number}
  • returns {String}

{{remainder}}

Get the remainder when a is divided by b.

Params

  • a {Number}: a
  • b {Number}: b

{{round}}

Round the given number.

Params

  • number {Number}
  • returns {Number}

{{subtract}}

Return the product of a minus b.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{sum}}

Returns the sum of all numbers in the given array.

Params

  • array {Array}: Array of numbers to add up.
  • returns {Number}

Example

{{sum "[1, 2, 3, 4, 5]"}}
<!-- results in: '15' -->

{{times}}

Multiply number a by number b.

Params

  • a {Number}: factor
  • b {Number}: multiplier
  • returns {Number}