math.Truncate

From Garry's Mod
Jump to: navigation, search
 math.Truncate( )

Contents

Description

Rounds towards zero.

Arguments

number num

The number to truncate

Arguments

number digits=0

The amount of digits to keep after the point.

Examples

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
Personal tools
Navigation