floor<T extends num> static method

T floor<T extends num>(
  1. num n
)

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}]";
	}
}