mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #44943 from DanRoscigno/pmod-docs
updater positiveModulo docs
This commit is contained in:
commit
5ba6851629
@ -65,10 +65,27 @@ An exception is thrown when dividing by zero or when dividing a minimal negative
|
||||
|
||||
Differs from [modulo](#modulo) in that it returns zero when the divisor is zero.
|
||||
|
||||
## positive_modulo(a, b)
|
||||
Calculates the remainder when dividing `a` by `b`. Similar to function `modulo` except that `positive_modulo` always return non-negative number.
|
||||
## positiveModulo(a, b), positive_modulo(a, b), pmod(a, b)
|
||||
Calculates the remainder when dividing `a` by `b`. Similar to the function `modulo` except that `positive_modulo` always returns a non-negative number.
|
||||
|
||||
Notice that `positive_modulo` is 4-5 times slower than `modulo`. You should not use `positive_modulo` unless you want to get positive result and don't care about performance too much.
|
||||
Notice that `positive_modulo` is 4-5 times slower than `modulo`. You should not use `positive_modulo` unless you want to get a positive result and don't care about performance too much.
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT positiveModulo(-1, 10)
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```text
|
||||
|
||||
┌─positiveModulo(-1, 10)─┐
|
||||
│ 9 │
|
||||
└────────────────────────┘
|
||||
```
|
||||
|
||||
## negate(a), -a operator
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user