-
Notifications
You must be signed in to change notification settings - Fork 262
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
introduce zero_expr()
and one_expr()
for number types
#8441
Conversation
This adds ::zero_expr() and ::one_expr() for integers, natural numbers, rationals and reals.
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.
Should we take this opportunity to deprecate exprt::is_zero
and exprt::is_one
? I'd like to think that e.is_zero()
would better be written as e == e.type().zero_expr()
(with some extra type cast of e.type()
to something more specific than typet
).
I considered this, but that will only work when there is a canonical representation for the respective number. This works for integers and naturals, but, for instance, not for floats, rationals and reals. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8441 +/- ##
===========================================
+ Coverage 78.19% 78.27% +0.07%
===========================================
Files 1726 1726
Lines 189068 188879 -189
Branches 18273 18322 +49
===========================================
Hits 147841 147841
+ Misses 41227 41038 -189 ☔ View full report in Codecov by Sentry. |
But then |
They are fine -- they do handle the multiple representations. |
This adds
.zero_expr()
and.one_expr()
for integers, natural numbers, rationals and reals.