aboutsummaryrefslogtreecommitdiff
path: root/src/lib/math.js
blob: 9b45cf0e6886f308061e88424fc3ecdfa3f0e537 (plain)
1
2
3
4
5
6
7
8
/**
 * Modulo that acts well with negative numbers.
 * @param {number} dividend the number to divide
 * @param {number} divisor the divisor to calculate the remainder
 */
export const modulo = function modulo(dividend, divisor) {
	return ((dividend % divisor) + divisor) % divisor;
};