15 lines
No EOL
403 B
Text
15 lines
No EOL
403 B
Text
### What it does
|
|
Checks for modulo arithmetic.
|
|
|
|
### Why is this bad?
|
|
The results of modulo (%) operation might differ
|
|
depending on the language, when negative numbers are involved.
|
|
If you interop with different languages it might be beneficial
|
|
to double check all places that use modulo arithmetic.
|
|
|
|
For example, in Rust `17 % -3 = 2`, but in Python `17 % -3 = -1`.
|
|
|
|
### Example
|
|
```
|
|
let x = -17 % 3;
|
|
``` |