You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

is_factor

Returns true if a given divisor is a factor of a given value, false otherwise.

is_factor(divisor, value)
Returns true if a given divisor is a factor of a given value, false otherwise.
COPY/// @func   is_factor(divisor, value)
///
/// @desc   Returns true if a given divisor is a factor of
///         a given value, false otherwise.
///
/// @param  {real}      divisor     divisor
/// @param  {real}      value       value
///
/// @return {bool}      true if a factor
///
/// GMLscripts.com/license

function is_factor(divisor, value)
{
    var remainder = value mod divisor;
    return (remainder == 0 || remainder == divisor);
}

Contributors: Leif902, xot

GitHub: View · Commits · Blame · Raw