Garry's Mod Wiki

math.Truncate

math.Truncate( number num, number digits = 0 )

Description

Rounds towards zero.

Arguments

1 number num
The number to truncate
2 number digits = 0
The amount of digits to keep after the point.

Example

Demonstrates the use of this function.

local num = 54.59874 print( math.Truncate( num, 2 ) ) -- 54.59 print( math.Round( num, 2 ) ) -- 54.6
Output: 54.59 54.6

Page Links


Special Pages


Wikis

?

Render Time: 22ms

DB GetPage 3
Generate Html 3
SaveChanges (1) 8
Render Body 0
Render Sidebar 6