Skip to main content

pmod

pmod​

description​

Syntax​

BIGINT PMOD(BIGINT x, BIGINT y)
DOUBLE PMOD(DOUBLE x, DOUBLE y)

Returns the positive result of x mod y in the residue systems. Formally, return (x%y+y)%y.

example​

MySQL [test]> SELECT PMOD(13,5);
+-------------+
| pmod(13, 5) |
+-------------+
| 3 |
+-------------+

MySQL [test]> SELECT PMOD(-13,5);
+-------------+
| pmod(-13, 5) |
+-------------+
| 2 |
+-------------+

keywords​

PMOD