floor<T extends num> static method
Rounds n
to the closest smaller integer. The returned value is of the
same type as n
.
Implementation
static T floor<T extends num>(num n) {
if (T == double || T == num) {
return n.floorToDouble() as T;
}
else if (T == int) {
return n.floor() as T;
}
else {
throw "can't floor to type [${T}]";
}
}