mod1
mod1(x,m)
Modulus after division, returning in the range (0,m]
Examples
julia> mod1(7, 4)
3
julia> mod1(-5, 3)
1
julia> mod1(10, 10)
0
The mod1
function calculates the modulus after division, returning a value within the range (0, m]
, where x
is the numerator and m
is the divisor.
Here are some examples of its usage:
-
Calculate modulus with positive numerator and divisor:
julia> mod1(7, 4) 3
In this example, 7 divided by 4 gives a remainder of 3.
-
Calculate modulus with negative numerator and positive divisor:
julia> mod1(-5, 3) 1
When the numerator is negative (-5) and the divisor is positive (3), the modulus is 1.
- Calculate modulus when numerator is equal to the divisor:
julia> mod1(10, 10) 0
When the numerator (10) is equal to the divisor (10), the modulus is 0.
Please note that the mod1
function always returns a value within the range (0, m]
, even when the numerator is negative.
See Also
abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.