rounded

rounded(): Integer;

The rounded method of the Decimal primitive type returns an integer containing the rounded value of the receiver.

The following code fragment shows the use of the rounded method.

write (6.4).Decimal.rounded;   // outputs 6 [0,1,2,3,4 are rounded down]
write (6.5).Decimal.rounded;   // outputs 7 [5,6,7,8,9 are rounded up]

write (-6.4).Decimal.rounded;  // outputs -6 [0,1,2,3,4 are rounded up]
write (-6.5).Decimal.rounded;  // outputs -7 [5,6,7,8,9 are rounded down]