# Round

### From Xojo Documentation

 You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Global Method

Round(value as Double) As Double

Supported for all project types and targets.

Returns the passed value rounded to the nearest whole number.

## Syntax

result = Round (value)

Part Type Description
result Double The rounded value. Although result is typed as a Double, it actually contains an integer value.
value Double The value you want to round.

## Notes

The result of this function is a Double, but it will always contain a whole number.

The method used to round is chosen by the operating system and the results may vary from platform to platform when the number to be rounded is exactly halfway between two whole numbers.

## Examples

This example uses the Round function to return a rounded number

Var d As Double
d = Round(1.499) // returns 1
d = Round(1.500) // returns 2

To round to a specific decimal place, multiple your value first and then divide it. For example to round 99.46789 to the first decimal place (tenths):

Var passPercent As Double = 99.46789
passPercent = Round(passPercent * 10) / 10 // 99.5

For examples of how to round a decimal number to a certain number of decimal places, see the Floor and/or Ceil functions.