Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

Truncate

Last wiki revision 2010-01-18

Truncate a number off to n places. number = truncate(number, decimals)

  • number: Number. The number to truncate.
  • decimals : Number. Truncate to this many places.
  • number : Number. The truncated number.

local number = truncate(math.pi, 3) print(number)

Prints: 3.141

function truncate(number, decimals) return number - (number % (0.1 ^ decimals)) end

  • round

Source

https://warcraft.wiki.gg/wiki/Truncate · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.