Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edits and checks for modulus, division, and exponentiation #1792

Merged
merged 5 commits into from Jan 2, 2020

Conversation

@iamdefinitelyahuman
Copy link
Contributor

iamdefinitelyahuman commented Dec 28, 2019

What I did

  • Modify modulus calculations for literals to be consistent with the EVM - closes #1693
  • Explicitly disallow the use of exponentiation on decimal values - closes #1698
  • Add compile-time checks for divide by zero and modulo by zero

How I did it

  • For literal modulus calculations, calculate abs(a) % abs(b) and then return a negative value if a < 0. This is consistent with the results of SMOD.
  • Add ZeroDivisionException to allow raising zero division errors with code highlights
  • various minor edits to vyper/parser/expr.py - mostly raising exceptions

How to verify it

Run the tests. I added more test cases around these behaviors.

Cute Animal Picture

image

Copy link
Member

fubuloubu left a comment

Please rebase tho

@fubuloubu fubuloubu merged commit 374456c into vyperlang:master Jan 2, 2020
8 checks passed
8 checks passed
lint
Details
mypy
Details
py36-core
Details
py37-core py37-core
Details
py38-core
Details
fuzzing
Details
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No new or fixed alerts
Details
@iamdefinitelyahuman iamdefinitelyahuman deleted the iamdefinitelyahuman:arithmetic2 branch Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.