Official Content

Rounds the value of a given numeric expression.

Syntax

Numeric-expression.Round(nK)

Where:

Numeric-expresion
     Is a Numeric expression that indicates the number the method will be applied to.

nK
   Must be a numeric constant.
 

Type Returned:
Numeric

Scope

Data Types: Numeric
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

This function rounds the value of Numeric-expression1 to nK decimals. The rounding threshold is 5. That is, below 5 is rounded downwards, otherwise the value is rounded upwards.

nK must be a Numeric Constant. If nK is a negative number, the Round function apply to the integer part of the number.

Samples

&NewVal = &Val.Round(0)    // &Val=1.5    then &NewVal = 2
&NewVal = &Val.Round(0)    // &Val=1.4    then &NewVal = 1
&NewVal = &Val.Round(1)    // &Val=1.25   then &NewVal = 1.3
&NewVal = &Val.Round(1)    // &Val=1.24   then &NewVal = 1.2
&NewVal = &Val.Round(-1)   // &Val=125.11 then &NewVal = 130 

See Also

Round function
Trunc function
Truncate method






Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant