forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
6.6 KiB
6.6 KiB
pmod
This function is used to return the positive value of the remainder after division of x by y.
Syntax
pmod(INT a, INT b)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
a |
Yes |
DOUBLE, BIGINT, DECIMAL, or STRING |
The value can be a float, integer, or string. |
b |
Yes |
DOUBLE, BIGINT, DECIMAL, or STRING |
The value can be a float, integer, or string. |
Return Values
The return value is of the DECIMAL or INT type.
Example Code
The value 2 is returned.
select pmod(2,5);
The value 3 is returned.
select pmod (-2,5) (parse: -2=5* (-1)...3);
The value NULL is returned.
select pmod(5,0);
The value 1 is returned.
select pmod(5,2);
The value 0.877 is returned.
select pmod(5.123,2.123);
Parent topic: Mathematical Functions