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

strided intervals: min_int() returns a negative value #290

Open
lwerdna opened this issue Sep 10, 2022 · 0 comments
Open

strided intervals: min_int() returns a negative value #290

lwerdna opened this issue Sep 10, 2022 · 0 comments
Assignees
Labels

Comments

@lwerdna
Copy link

lwerdna commented Sep 10, 2022

In strided intervals, the maximum and minimum values for a given width are returned by four functions, depending on how you want to interpret the bits.

For unsigned interpretation there are min_int() and max_int().
For signed interpretation there are signed_min_int() and signed_max_int().

Here they are all tested for 32-bit width:

StridedInterval.min_int(32)         # -0x80000000    <-- ERROR
StridedInterval.max_int(32)         #  0xffffffff    <-- OK
StridedInterval.signed_max_int(32)  #  0x7fffffff    <-- OK
StridedInterval.signed_min_int(32)  # -0x80000000    <-- OK

Observed behavior: The unsigned version for 32-bit width returns that the minimum value is -134217728 or -0x80000000.

Expected behavior: It should return 0, the truly minimum value in unsigned interpretation.

@ltfish ltfish added the bug label Jan 2, 2023
@ltfish ltfish self-assigned this Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants