floor method

Decimal floor({
  1. int scale = 0,
})

Returns the greatest Decimal value no greater than this Rational.

An optional scale value can be provided as parameter to indicate the digit used as reference for the operation.

var x = Decimal.parse('123.4567');
x.floor(); // 123
x.floor(scale: 1); // 123.4
x.floor(scale: 2); // 123.45
x.floor(scale: -1); // 120

Implementation

Decimal floor({int scale = 0}) => _scaleAndApply(scale, (e) => e.floor());