The rounding activities can be used to round numerical values into integers or specified decimals
Activity properties
Possible rounding options
Rounds up to an integer.
Example:
DecimalValue = 3.3
begin var RoundingValue: Integer; RoundingValue := Ceil(DecimalValue); end; |
Result = 4
Rounds down to an integer.
Example:
DecimalValue = 3.3
begin var RoundingValue: Integer; RoundingValue := Floor(DecimalValue); end; |
Result = 3
Returns the part after the ',' from a decimal.
Example:
DecimalValue = 3.3
begin var RoundingValue: Integer; RoundingValue := Frac(DecimalValue); end; |
Result = 0.3
Rounds a floating-point value to a specified power of ten.
The 'Digits to round' will be a positive integer in the RoundTo function.
Example:
DecimalValue = 1234.1234
Digets to round = 2
begin var RoundingValue: Double; RoundingValue := RoundTo(DecimalValue, 2); end; |
Result = 1200
Rounds a floating-point value to a specified digit.
The 'Digits to round' will be a negative integer in the RoundTo function
Example:
DecimalValue = 1234.1234
Digits to round = 2
begin var RoundingValue: Double; RoundingValue := RoundTo(DecimalValue, 2); end; |
Result = 1234.12
Drops everething behind the ',' part of a decimal without rounding.
Example:
DecimalValue = -3.56
begin var RoundingValue: Double; RoundingValue := Trunc(DecimalValue); end; |
Result = -3
Returns the part before the ',' from a decimal.
Example:
DecimalValue = 3.6
begin var RoundingValue: Double; RoundingValue := Trunc(DecimalValue); end; |
Result = -3