Skip to content

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

Merged
fubuloubu merged 5 commits into
vyperlang:masterfrom
iamdefinitelyahuman:arithmetic2
Jan 2, 2020
Merged

Edits and checks for modulus, division, and exponentiation#1792
fubuloubu merged 5 commits into
vyperlang:masterfrom
iamdefinitelyahuman:arithmetic2

Conversation

@iamdefinitelyahuman
Copy link
Copy Markdown
Contributor

What I did

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
Copy Markdown
Contributor

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase tho

@fubuloubu fubuloubu merged commit 374456c into vyperlang:master Jan 2, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the arithmetic2 branch January 7, 2020 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decimals can't be the base for exponentiation Modulo at compile time differs from modulo at runtime

2 participants