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
interpreter: (cf) add cf interpreter functions and extend arith #1217
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1217 +/- ##
==========================================
+ Coverage 88.66% 88.90% +0.23%
==========================================
Files 167 169 +2
Lines 22873 22976 +103
Branches 3478 3498 +20
==========================================
+ Hits 20280 20426 +146
+ Misses 2038 1993 -45
- Partials 555 557 +2
☔ View full report in Codecov by Sentry. |
xdsl/interpreters/arith.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we see here one of the limitations of the Pyhton-based interpreter: Modellling fixed-size integers is nasty in Python. That's also why signed an unsigned are not distinguished in Python...
But I guess as long as we stay within reasonable boundaries, this should not matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess the problem here is that our interpreter should also take into account bitwidth, which it doesn't now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
def triangle_fn(n: int) -> int: | ||
result = 0 | ||
i = 0 | ||
while i <= n: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a question or an assertion? the whole function is n * (n-1) // 2
so can be done better indeed :)
469a826
to
ee034bc
Compare
No description provided.