# math/Round

From Garry's Mod

(Difference between revisions)

m (Also menu state) |
(update source lines) |
||

Line 1: | Line 1: | ||

{{Func | {{Func | ||

− | |||

− | |||

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

|Realm=Shared and Menu | |Realm=Shared and Menu | ||

|IsClass=No | |IsClass=No | ||

|File=lua/includes/extensions/math.lua | |File=lua/includes/extensions/math.lua | ||

− | |Line= | + | |Line=156-L162 |

}} | }} | ||

{{Arg | {{Arg |

## Latest revision as of 18:06, 15 November 2016

## 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

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