예제 #1
0
bool HiseJavascriptEngine::RootObject::isNumeric(const var& v) noexcept
{
	return v.isInt() || v.isDouble() || v.isInt64() || v.isBool();
}
예제 #2
0
	/** Returns the bigger number. */
	var max(var first, var second)
	{
		return (first.isInt() && second.isInt()) ? var(jmax((int)first, (int)second)) :
			var(jmax((double)first, (double)second));
	}
예제 #3
0
	/** Limits the value to the given range. */
	var range(var value, var lowerLimit, var upperLimit)
	{
		return value.isInt() ? var(jlimit<int>(lowerLimit, upperLimit, value)) :
			var(jlimit<double>(lowerLimit, upperLimit, value));
	}
예제 #4
0
	/** Returns the sign of the value. */
	var sign(var value)
	{
		return value.isInt() ? var(sign_((int)value)) :
			var(sign_((double)value));
	}
예제 #5
0
	/** Rounds the value to the next integer. */
	var round(var value)
	{
		return value.isInt() ? var(roundToInt((int)value)) :
			var(roundToInt((double)value));
	}
예제 #6
0
	/** Returns the absolute (unsigned) value. */
	var abs(var value)
	{
		return value.isInt() ? var(std::abs((int)value)) :
			var(std::abs((double)value));
	}