Garry's Mod Wiki

Garry's Mod Wiki

  number math.Round( number value, number decimals = 0 )

Description

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

Arguments

1 number value
The value to round.
2 number decimals = 0
The decimal places to round to.

Returns

1 number
The rounded value.

Example

Rounds a number to the nearest whole number.

print(math.Round(104.6256712))
Output: 105

Example

Rounds the number to two decimal places.

print(math.Round(104.6256712, 2))
Output: 104.63

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...