Fixed Point Intrinsic Functions - Round Method

Round the number to the nearest n decimal places

Member of Fixed Point Intrinsic Functions (PRIM_LIBI.IFixedPointIntrinsics)

Parameters

Name Type Data Type Description
Result *Result (Optional) Decimal Resulting number
Operation *Input (Optional) Enumeration Type of rounding to be performed
Decimals *Input (Optional) Integer Number of decimal places

Details

Round allows a number to be rounded to a specified number of decimal places using a selected rounding technique.
 
The default is to round HalfUp

Allowed Operations

Enum Value Description
Down Always round down
Up Always round up
HalfDown Round down if the rounding value is 5 or less
HalfUp Round up if the rounding value is 5 or more

Example

Rounding up 10.51 to 1 decimal place will produce a result of 10.6.
 
Rounding up 10.01 to 0 decimal place will produce a result of 11.0.
 
Rounding down 10.51 to 1 decimal place will produce a result of 10.5.
 
Rounding up 10.99 to 0 decimal place will produce a result of 11.0.
 
Rounding halfup 10.49 to 1 decimal place will produce a result of 10.5.
 
Rounding halfup 10.44 to 1 decimal place will produce a result of 10.4.
 
Rounding halfdown 10.44 to 1 decimal place will produce a result of 10.4.
 
Rounding halfdown 10.46 to 1 decimal place will produce a result of 10.5.
#Result := #Number.Round(Up 1)

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020