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
  1. /// @func is_factor(divisor, value)
  2. ///
  3. /// @desc Returns true if a given divisor is a factor of
  4. /// a given value, false otherwise.
  5. ///
  6. /// @param {real} divisor divisor
  7. /// @param {real} value value
  8. ///
  9. /// @return {bool} true if a factor
  10. ///
  11. /// GMLscripts.com/license
  12.  
  13. function is_factor(divisor, value)
  14. {
  15. var remainder = value mod divisor;
  16. return (remainder == 0 || remainder == divisor);
  17. }

Contributors: Leif902, xot

GitHub: View · Commits · Blame · Raw