# 3.5.1.1.36 Round

## Description

This function returns a value (or dataset) x with n decimal places.

 Note: Since Origin 9.1, a new algorithm has been used to calculate the rounding value. A system variable @RNA can be used to switch the rounding behavior. When @RNA=1 (default), round functions similarly as ROUND function in MS Excel. In this case, the half-way value is always rounded away from 0. When @RNA=0, round function behaves as previous versions. For example, when @RNA=0, round(2.55,1) =2.5; while @RNA=1, round(2.55,1) =2.6.

## Syntax

double round(double x, int n)

## Parameter

x

can be any real number.

n

is the decimal digits you want to get.

## Return

Returns a value (or dataset) x with n decimal places.

## Example

round(1.156, 1)=;     // ANS: ROUND(1.156, 1)=1.2
round(1.156, 0)=;     // ANS: ROUND(1.156, 0)=1