3.5.1.1.29 Mod2

Description

This function returns the integer modulus (the remainder from division) of integer n divided by integer m, which is denoted by formula

n-X*m

where X is the integer of \frac{n}{m} round toward negative infinity. It is functionally similar to MS Excel's mod function.

Syntax

int mod2(int n ,int m)

Parameter

n

is the dividend. Can be any integer.

m

is the divisor. Can be any integer.

Return

Returns the integer modulus of integer n divided by integer m.

Example

aa = mod(5, -3);
aa = ; //should return 2
bb = mod2(5, -3);
bb = ; //should return -1

See Also

mod(n, m), rmod(x, y)