Merge pull request #7428 from microbecode/docs-remove-abs

Fixed code example which utilizes non-existing function 'abs' - the v…
This commit is contained in:
chriseth 2019-09-16 19:21:37 +02:00 committed by GitHub
commit 54d936dda8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,7 @@ Modulo
The modulo operation ``a % n`` yields the remainder ``r`` after the division of the operand ``a`` The modulo operation ``a % n`` yields the remainder ``r`` after the division of the operand ``a``
by the operand ``n``, where ``q = int(a / n)`` and ``r = a - (n * q)``. This means that modulo by the operand ``n``, where ``q = int(a / n)`` and ``r = a - (n * q)``. This means that modulo
results in the same sign as its left operand (or zero) and ``a % n == -(abs(a) % n)`` holds for negative ``a``: results in the same sign as its left operand (or zero) and ``a % n == -(-a % n)`` holds for negative ``a``:
* ``int256(5) % int256(2) == int256(1)`` * ``int256(5) % int256(2) == int256(1)``
* ``int256(5) % int256(-2) == int256(1)`` * ``int256(5) % int256(-2) == int256(1)``