math.Round

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

Contents

Description

Rounds the given value to the nearest whole number or to the given decimal places.

Arguments

number value

The value to round.

Arguments

number decimals=0

The decimal places to round to.

Returns

number

The rounded value.

Examples

Example

Rounds a number to the nearest whole number.

print(math.Round(104.6256712))

Output:

105

Examples

Example

Rounds the number to two decimal places.

print(math.Round(104.6256712, 2))

Output:

104.63
Personal tools
Navigation