Creator Help

round()

This topic describes the syntax and usage of the round() function in Zoho Creator .

Description

The round() function returns the number after rounding off to the specified number of digits.

Syntax

<numeric>.round(<precision-numeric>)

Return Value

Returns the number after rounding off to the specified number of digits.

Example

num=81.256;

rounded_numt=num.round(2); // returns 81.26

Example

Round up/down a number to the nearest 1000. For example, to round up the number 133,768 to 134,000 or round down the number 133,768 to 133,000 you can add the following script

//Round up 133,768 to 134,000
Number = 133,768;
Rounded_Number = input.Number/ 1000;                    //gives 133.768
Rounded_Number = Rounded_Number.round(0);       //gives 134
Rounded_Number = Rounded_Number * 1000;           //gives 134,000

//Round up 133,768 to 133,000
Number = 133,768;
Rounded_Number = input. Number/ 1000;                 //gives 133.768
Whole_Number = Rounded_Number.tolong();           //gives 133 by converting to an integer
Rounded_Number = Whole_Number * 1000;             //gives 133,000

Top