Mod

Returns the modulus of one number divided by another. The modulus is the remainder of the division of the dividend by the divisor. The sign of the remainder always equals the sign of the dividend.

Syntax

Mod(n1, n2)

Parameters

Parameter

Description

n1

The dividend, a numeric value or expression.

n2

The divisor, a numeric value or expression.

If n1 and/or n2 are not numeric values or expressions, the function returns 0.

Note: FormCalc follows the IEEE-754 international standard when handling floating point numeric values. For more information, see Number literals.

Examples

The following expressions are examples of using the Mod function:

Expression

Returns

Mod(64, -3)

1

Mod(-13,3)

-1

Mod("abc", 2)

0

Mod(X[0], Y[9])

The first occurrence of X is used as the dividend and the tenth occurrence of Y is used as the divisor.

Mod(Round(Value[4], 2), Max(Value[*]))

The first fifth occurrence of Value rounded to two decimal places is used as the dividend and the highest of all non-null occurrences of Value is used as the divisor.

See also Max and Round.

// Ethnio survey code removed