Compute the remainder of a division with selectable remainder convention.
Numeric.math.mod(first, right = 1, method)Combines operands with NumPy style broadcast.
- Parameters:
first: Dividend as a scalar, vector, or matrixright: Divisor as a scalar, vector, or matrixmethod: Remainder convention applied to each quotient
- Returns: Remainders matching the broadcast shape of the operands
- NumPy: Covers
np.mod,np.remainder,np.fmod,np.divmodthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const remainder = Numeric.math.mod(10, 3)
console.log(remainder)
// 1import Numeric from '@neabyte/numerix'
const remainders = Numeric.math.mod([10, 20], 3)
console.log(remainders)
// [1,2]import Numeric from '@neabyte/numerix'
const remainders = Numeric.math.mod([10, 20], [3, 4])
console.log(remainders)
// [1,0]import Numeric from '@neabyte/numerix'
const remainder = Numeric.math.mod(-10, 3)
console.log(remainder)
// 2import Numeric from '@neabyte/numerix'
const remainder = Numeric.math.mod(-10, 3, 'fmod')
console.log(remainder)
// -1