ROUND
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Returns the rounded value of a numeric expression.
Syntax
|
Notes
- num_expression must be numeric or must be convertible to numeric.
-
num_expression must be one of these supported data types:
INTEGERTINYINTSMALLINTNUMBERFLOATDOUBLE PRECISION
- If the data type of num_expression is not a supported type,
ROUNDreturns an error message. - The num_expression is rounded to the next higher digit when:
- The digit before a negative rounding_factor is 5 or greater
- The digit after a positive rounding_factor is 5 or greater
- The num_expression is rounded to the next lower digit when:
- The digit before a negative rounding_factor is 4 or less
- The digit after a positive rounding_factor is 4 or less
-
rounding_factor is an integer between -32 and +32 inclusive, and
indicates the digit position to which you want to round num_expression.
The following figure illustrates how the digit positions are numbered. In the figure
below, the num_expression is
2953861.8320.Figure 1. ROUND digit positions 
- If you do not specify a rounding_factor, the function rounds num_expression to digit 0 (the ones place).
- To round to the right of the decimal point, specify a positive rounding_factor.
- To round to the left of the decimal, specify a negative rounding_factor.
Example
This example illustrates four calls to the ROUND function:
|
In each case the num_expression is 2953861.8320. In the
first call the rounding_factor is 2, in the second call
the rounding_factor is -2, in the third call
therounding_factor is 0, and in the fourth
call no rounding_factor is specified.
Compatibility
Progress extension