truncateToDouble abstract method
override
Returns the integer double value obtained by discarding any fractional
digits from 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 -1.0 < d < 0.0
will return -0.0
, and
in the range 0.0 < d < 1.0
it will return 0.0.
print(2.5.truncateToDouble()); // 2.0
print(2.00001.truncateToDouble()); // 2.0
print(1.99999.truncateToDouble()); // 1.0
print(0.5.truncateToDouble()); // 0.0
print((-0.5).truncateToDouble()); // -0.0
print((-1.5).truncateToDouble()); // -1.0
print((-2.5).truncateToDouble()); // -2.0
Implementation
double truncateToDouble();