/**
 * Some additions on Number.
 */

Number.prototype.epsilon = 1.0e-8;

Number.prototype.isZero = function() {
	return Math.abs(this) < this.epsilon;
}

Number.prototype.equals = function(x) {
	return this.isZero() ? x.isZero() : (x / this - 1).isZero();
}

Number.prototype.isLessThan = function(x) {
	return this < x - this.epsilon;
}

Number.prototype.isGreaterThan = function(x) {
	return this > x + this.epsilon;
}

Number.prototype.isLessThanOrEqual = function(x) {
	return this < x + this.epsilon;
}

Number.prototype.isGreaterThanOrEqual = function(x) {
	return this > x - this.epsilon;
}

Number.prototype.squared = function() {
	return this * this;
}

