round method

num round()

Returns the integer nearest to this num.

For example:

const a = -42.5;
const b = 42.5;
assert(a.round() == -43);
assert(b.round() == 43);

Implementation

num round() => this < 0 ? (this - 0.5).floor() : (this + 0.5).floor();