truncatedTo

truncatedTo(decimalPlaces: Integer): Decimal;

The truncatedTo method of the Decimal primitive type returns the receiver truncated to the number of decimal places specified in the decimalPlaces parameter.

The following example shows the use of the truncatedTo method.

testDecimal();
vars
    decimalValue : Decimal [12,4];
begin
    decimalValue := 340.56789;              // Defines the variable value
    decimalValue := (decimalValue/20).truncatedTo(2);
    write decimalValue;                     // Outputs 17.02
end;