MODULO
Description
The modulo operator returns the remainder of a division of both arguments.
The result has always the same sign as the first argument. If at least one of the input arguments is NULL, the result is NULL as well.
Both arguments can be INT or FLOAT values. If both input arguments are INTs, the return type is also an INT. Otherwise, the result is a FLOAT.
Syntax
MODULO ( dividend, divisor )
dividend % divisor
NULL handling
If one of the input values is NULL, the result is NULL as well.
Examples
[1] Calculate the modulo of integers. The result has always the same sign as the first argument: | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
|
[2] Calculate the modulo of integers with NULL values. If at least one input value is NULL, the result is NULL as well: | |||||||||||||||||||
| |||||||||||||||||||
|
[3] Calculate the modulo of floats. The result is always a float: | ||||||||||||||||
| ||||||||||||||||
|
[4] Calculate the modulo of an integer divided by a float. The result is always a float: | ||||||||||||||||
| ||||||||||||||||
|
[5] Calculate the modulo of a float divided by an integer. The result is always a float: | ||||||||||||||||
| ||||||||||||||||
|