mod - Modulo function

Prev Next

Function Names

mod

Description

Calculates the remainder (modulo) of a value.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1.
input
numeral Divisor

Value to divide by dividend

2.
input
numeral Dividend

Dividend is used for the division following extracting the remainder value

Default value: 1

Return value

TypeDescription
numeral Remainder

Calculated remainder

Exceptions

Values provided is not a numerals
rounding intervals is negative or zero

Examples

      for all parameters( { {10, 3}, {10.25,0.02}, {10.5, 2} }, p[] )
          echo( p[]{0}, " mod ", p[]{1}, " = ", mod( p[]{0}, p[]{1} ) );

Output

10 mod 3 = 1
10.25 mod 0.02 = 0.01
10.5 mod 2 = 0.5
Try it yourself: Open LIB_Function_mod.b4p in B4P_Examples.zip. Decompress before use.