Function Round() Foundation
Rounds a numeric value to a specific number of decimal places.
Round( <nValue>, <nDecimals>) --> nRoundedValue
Round() returns a numeric value.
When <nDecimals> is greater than or equal to zero, the numeric function Round() rounds the value <nValue> to the number of decimal places specified by <nDecimals>. When <nDecimals> is a negative value, the places before the decimal point are rounded. The digits 5 to 9 are rounded up, while the digits 0 to 4 round down.
// The example shows various results of the function Round().
PROCEDURE Main
SET DECIMALS TO 4
SET FIXED ON
? Round( 121.4487, 0) // result: 121.0000
? Round( 121.4487, 1) // result: 121.4000
? Round( 121.4487, 2) // result: 121.4500
? Round( 121.4487, 3) // result: 121.4490
? Round( 121.4487,-1) // result: 120.0000
? Round( 121.4487,-2) // result: 100.0000
? Round( 121.4487,-3) // result: 0.0000
SET FIXED OFF
? Round( 121.4487, 0) // result: 121
? Round( 121.4487, 1) // result: 121.4
? Round( 121.4487, 2) // result: 121.45
? Round( 121.4487, 3) // result: 121.449
? Round( 121.4487,-1) // result: 120
? Round( 121.4487,-2) // result: 100
? Round( 121.4487,-3) // result: 0
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.