pmod function

Returns the positive remainder after dividend / divisor.

Syntax

pmod(dividend, divisor)

Arguments

  • dividend: An expression that evaluates to a numeric.

  • divisor: An expression that evaluates to a numeric.

Returns

If both dividend and divisor are of DECIMAL the result matches the type of divisor. In all other cases a DOUBLE.

If divisor is 0 the function raises a DIVIDE_BY_ZERO error.

This function is equivalent to abs(mod(dividend, divisor)).

Examples

> SELECT pmod(10, 3);
 1

> SELECT pmod(-10, 3);
 2

> SELECT pmod(-10, 0);
 Error: DIVIDE_BY_ZERO