floorToDouble method

double? floorToDouble()

Returns the greatest integer double value no greater than this.

If this is already an integer valued double, including -0.0, or it is not a finite value, the value is returned unmodified.

For the purpose of rounding, -0.0 is considered to be below 0.0. A number d in the range 0.0 < d < 1.0 will return 0.0.

print(Obj(1.99999).floorToDouble()); // 1.0
print(Obj(2.0).floorToDouble()); // 2.0
print(Obj(2.99999).floorToDouble()); // 2.0
print(Obj(-1.99999).floorToDouble()); // -2.0
print(Obj(-2.0).floorToDouble()); // -2.0
print(Obj(-2.00001).floorToDouble()); // -3.0

Implementation

double? floorToDouble() => value?.floorToDouble();